Great! I'm glad you're looking at this. It sounds like it might be the
right time to look at this again seriously.
There are a couple of main reasons why we have not heavily pursued
websockets in our project at Drake up to this point. I should mention
that Ira Hanson (here at Drake) did a little exploration with websockets
at the beginning of the summer.
1. The libraries were not mature when we started, and we'd rather spend
time writing the code that was unique to our project, especially since
we were still experimenting with different designs. We tried to design
with an eye towards supporting websockets or long polling eventually,
though. Along with the libraries, the technology itself wasn't mature,
which I think was pointed out in previous threads (sorry, I don't have
internet right now, so I can't look up the previous threads)
From what work you've said, it sounds like the libraries are getting to
the point that we can look at it seriously. I would love to support
socket.io, which (IIRC) supports a variety of polling strategies seamlessly.
2. I anticipate a large number of requests relative to the device
backends, so a computation might sit for a while (a second or two) in
the database before being picked up and evaluated. A batch-processing
system seems more efficient for that case. However, having a websocket
connection for interacts seems to make a lot of sense. Interacts will
probably be a significant portion of the traffic.
3. We needed a system that would work across a wide variety of browsers
and versions, so we implemented the lowest common denominator (simple
polling). I believe socket.io takes care of the cross-browser issues,
so again, it sounds like it might be great to implement this.
4. We also designed with an eye toward having a very simple web service.
Clients that use the web service may or may not be able to support
websockets, so again, we implemented the lowest common denominator
simple client polling.
>
> Now, and I'm finishing (thanks God), would it be possible to avoid
> polling from the client by using the method I exposed before?
I would love to see the client polling removed for the clients that can
support it.
>
> And, about the database part: wouldn't it be easier to notify the
> device with a �MQ socket when there is a new message in the database?
>
The goal here was minimizing traffic by batching requests, with an eye
towards sustaining a large number of requests with a low average
response time. I think this area is ripe for experimenting to see if
notifying the devices like you suggest can sustain the same load.
Thanks,
Jason
Ira just spent a lot of time in the last couple of days documenting
things. I just pushed his changes to the master branch, so hopefully
the documentation is better now. He's working on the README right now too.
Ira: could you add to the readme or somewhere a short description of the
overall architecture? I know there's something in the device_process
file that documents part of the architecture, but it would be very
valuable to have a big overview of how things work.
Thanks,
Jason
We have Drake University and the NSF to thank for funding me, Ira, and
another student (Alex Kramer) to work on this!
That said, work is winding down on this over the next two weeks, so it
would be *great* to get feedback and suggestions on this ASAP. We hope
to have something that is polished in about two weeks.
Thanks,
Jason
That said, work is winding down on this over the next two weeks, so it
would be *great* to get feedback and suggestions on this ASAP. We hope
to have something that is polished in about two weeks.