|
Post by louisatome on Dec 8, 2017 8:37:58 GMT
Hello,
For my app I need a way to communicate from view side (JS) to controller side (Ruby) with low latency and bidirectionally. Currently, I use a WebSocket to send messages from one side to the other but I would like to know if there is a better way to do this ?
Thanks in advance
Louis
|
|
|
Post by jontara on Dec 14, 2018 7:41:00 GMT
Is there something about it you're unhappy with? It sounds like a good way to me!
Do you have a latency problem now? Latency should be essentially zero. Do you mean bandwidth instead?
How do you encode the data? JSON? There are some binary JSON-like alternative. It would improve bandwidth.
I would NOT suggest gzip-encoding, because the encoding/decoding overhead is almost certainly greater than any bandwidth benefit. Gzip is appropriate for talking to an Internet server, but not within the same CPU.
What kind of data, what size?
What are you using for Ruby websocket? Does it include native code, or pure ruby?
|
|
|
Post by louisatome on Dec 14, 2018 9:33:03 GMT
Hello Jon, Yes I send JSON messages from JS to Ruby and vice versa. The messages can be all sizes and sometimes I can have a lot of messages simultaneously. The WebSocket works geat in general but I was wondering as the two layers (JS, Ruby) are within the same process if there was a more "direct" way to send informations from one to another. The Websocket implementation I use is in pure ruby : github.com/imanel/websocket-rubyThanks, Louis
|
|