http server help

#1

I’ve gotten quite far in my autobahn app, with the backend in Nodejs. Right now Crossbar delivers the initial page, then all communication with the server occurs via autobahn. However, now I need to accept posts from 3rd parties and I’m not sure of the best route to go. From what I can tell Crossbar won’t deal with posts, just gets. I’m assuming that the first step would be to remove the web transport from config.json. Seeing as my backend is already a node app I can add handling get/post to it. Or I can start a second node process to handle get/post.

Am I on the right track? And is one node app preferable or inferior to 2 node apps? If I use one app to handle it all do I need to worry about the http ‘upgrade’ event? Or is crossbar handling the upgrade?

Any advice would be helpful.

Thanks!

0 Likes

#2

I got this worked out. In my node program I added the code for an http server on port 8888. I left the web endpoint in config.json on port 8000. Now I load my pages from port 8888 and set autobahn to connect on port 8000 in the browser. I figured I didn’t need to have a path of ‘/’ still specified in config.json but crossbar won’t start without it. All works fine, so now I can server http and ws requests from the same node program.

0 Likes

#3

Hi Greg,

Crossbar.io is primarily a WAMP router.

The fact that it is able to serve static HTML via plain old HTTP as well is a “convenience”.

Means: Crossbar.io is not supposed to be a Web server framework, and hence if you want to do “special stuff” like HTTP/POSTs with app specific code, you will need to have your app code listen for that incoming HTTP.

As you noticed, it’s absolutely fine to have a Node WAMP component started from Crossbar.io also open a HTTP listenting port to accept POSTs or whatever.

Cheers,
/Tobias

···

Am Dienstag, 23. Dezember 2014 00:42:49 UTC+1 schrieb Greg Miller:

I got this worked out. In my node program I added the code for an http server on port 8888. I left the web endpoint in config.json on port 8000. Now I load my pages from port 8888 and set autobahn to connect on port 8000 in the browser. I figured I didn’t need to have a path of ‘/’ still specified in config.json but crossbar won’t start without it. All works fine, so now I can server http and ws requests from the same node program.

0 Likes