[99s-extend] Websocket vs. Request-Response msg pair
Graham Hay
grahamrhay at gmail.com
Wed Jun 24 12:19:39 CEST 2015
I think you'd have to roll your own, you just need some way to correlate
<http://www.enterpriseintegrationpatterns.com/CorrelationIdentifier.html>
responses
with the originating request. OTP does something similar under the hood
with gen_server calls <http://www.erlang.org/doc/man/gen_server.html#call-2>
.
It's also possible to treat the ws connection as a messaging channel, and
use something like selective consumer
<http://www.enterpriseintegrationpatterns.com/MessageSelector.html> to
de-multiplex the messages. e.g. you could add a type/channel field to each
message, and only subscribe to those messages.
Remember that once you move into an async world, there are no guarantees
that you will receive a response! So you need to start thinking about
timeouts etc.
On 24 June 2015 at 10:18, Robert Balogh <ethrbh at gmail.com> wrote:
> hello,
>
> According to you grate support I got from you at yesterday, I could
> continue my project, where I use Cowboy webserver and using Websocket. Now
> I made an own web page with basic features I need, so the server and client
> can communicates to eachother. I like it.
>
> Now I would like to step forward, and I would like to implement a
> Request-Response mechanism. I read few articles in to this topic, and all
> of them has mentioned this "feature" is not part of the Websocket standard.
> They were suggested to use some sub-protocols for this, but I did not see
> any written in Erlang.
>
> So, I would like to ask you, do I understand right that Cowboy does not
> have this feature too? If so, do you have some idea how can I implement a
> basic request-response mechanism? Probably one of you guys in this forum
> have some idea.
>
> Btw, the links I read about this topic:
>
> http://stackoverflow.com/questions/10882370/websocket-request-response-subprotocol
> http://alabor.me/articles/request-response-oriented-websockets/
> https://www.npmjs.com/package/primus-responder
>
> thanks for your help,
> /Robi
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20150624/6d15706e/attachment.html>
More information about the Extend
mailing list