I have an IoT device that will eventually have thousands connected to our Meteor server and I am trying to figure out the best way to connect.
I see two different ways. There is the sockjs url (sockjs/serverId/sessionId/websocket) or just a normal websocket (/websocket)
So I am trying to figure out which is the better one to use.
From my investigation /websocket is the cleanre interface and involves less communication, but the /sockjs seems like it has more bells and whistles that will help load balancing the server.
Do I understand the sockjs url enough that it would help a service like heroku keep session affinity and with load balancing? Or is that also taken care of by the /websocket url?
Also is sockjs likely to be removed from Meteor? I don’t want to implement something that will be removed in the future.
I’m trying to figure out what is the best way to make sure that this is very scalable, but I need a bit more info than I can easily find.
Do you really need sockets at all ?
Maybe a REST API would be best, less server load, less energy consuming for the devices.
If sockets are needed why not use ddp ?
Load balancing should be handled by a reversed proxy (such as nginx).
Yes my use case needs instant feedback from the arduino so it does require a websocket connection.
DDP is just a wrapper around sockjs/native websocket so its not really relevant.
So my question is what is better for the server, sockjs or native websocket. Sockjs has unique urls that may allow heroku to handle it better as we grow, but native Websocket is just less communication (by like 5% so not super important)
So the question is does sockjs provide any extra benefit to the server, or is it just a way to abstract the api so we can use long polling in older browsers?