summaryrefslogblamecommitdiffstats
path: root/archives/extend/2015-June/000541.html
blob: e0f25c6f80e6d1e3d74e90298598e698a670eda2 (plain) (tree)





















































































































                                                                                                                                                                                                                                        
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
   <TITLE> [99s-extend] Websocket vs. Request-Response msg pair
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Websocket%20vs.%20Request-Response%20msg%20pair&In-Reply-To=%3CCAABECY1-3dxX337kaShnxa3EuH1OAUyKVgonLoM9qAOQN6DNvw%40mail.gmail.com%3E">
   <META NAME="robots" CONTENT="index,nofollow">
   <style type="text/css">
       pre {
           white-space: pre-wrap;       /* css-2.1, curent FF, Opera, Safari */
           }
   </style>
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="000540.html">
   <LINK REL="Next"  HREF="000543.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] Websocket vs. Request-Response msg pair</H1>
    <B>Graham Hay</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Websocket%20vs.%20Request-Response%20msg%20pair&In-Reply-To=%3CCAABECY1-3dxX337kaShnxa3EuH1OAUyKVgonLoM9qAOQN6DNvw%40mail.gmail.com%3E"
       TITLE="[99s-extend] Websocket vs. Request-Response msg pair">grahamrhay at gmail.com
       </A><BR>
    <I>Wed Jun 24 12:19:39 CEST 2015</I>
    <P><UL>
        <LI>Previous message: <A HREF="000540.html">[99s-extend] Websocket vs. Request-Response msg pair
</A></li>
        <LI>Next message: <A HREF="000543.html">[99s-extend] Websocket vs. Request-Response msg pair
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#541">[ date ]</a>
              <a href="thread.html#541">[ thread ]</a>
              <a href="subject.html#541">[ subject ]</a>
              <a href="author.html#541">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>I think you'd have to roll your own, you just need some way to correlate
&lt;<A HREF="http://www.enterpriseintegrationpatterns.com/CorrelationIdentifier.html">http://www.enterpriseintegrationpatterns.com/CorrelationIdentifier.html</A>&gt;
responses
with the originating request. OTP does something similar under the hood
with gen_server calls &lt;<A HREF="http://www.erlang.org/doc/man/gen_server.html#call-2">http://www.erlang.org/doc/man/gen_server.html#call-2</A>&gt;
.

It's also possible to treat the ws connection as a messaging channel, and
use something like selective consumer
&lt;<A HREF="http://www.enterpriseintegrationpatterns.com/MessageSelector.html">http://www.enterpriseintegrationpatterns.com/MessageSelector.html</A>&gt; 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 &lt;<A HREF="https://lists.ninenines.eu/listinfo/extend">ethrbh at gmail.com</A>&gt; wrote:

&gt;<i> hello,
</I>&gt;<i>
</I>&gt;<i> According to you grate support I got from you at yesterday, I could
</I>&gt;<i> continue my project, where I use Cowboy webserver and using Websocket. Now
</I>&gt;<i> I made an own web page with basic features I need, so the server and client
</I>&gt;<i> can communicates to eachother. I like it.
</I>&gt;<i>
</I>&gt;<i> Now I would like to step forward, and I would like to implement a
</I>&gt;<i> Request-Response mechanism. I read few articles in to this topic, and all
</I>&gt;<i> of them has mentioned this &quot;feature&quot; is not part of the Websocket standard.
</I>&gt;<i> They were suggested to use some sub-protocols for this, but I did not see
</I>&gt;<i> any written in Erlang.
</I>&gt;<i>
</I>&gt;<i> So, I would like to ask you, do I understand right that Cowboy does not
</I>&gt;<i> have this feature too? If so, do you have some idea how can I implement a
</I>&gt;<i> basic request-response mechanism? Probably one of you guys in this forum
</I>&gt;<i> have some idea.
</I>&gt;<i>
</I>&gt;<i> Btw, the links I read about this topic:
</I>&gt;<i>
</I>&gt;<i> <A HREF="http://stackoverflow.com/questions/10882370/websocket-request-response-subprotocol">http://stackoverflow.com/questions/10882370/websocket-request-response-subprotocol</A>
</I>&gt;<i>     <A HREF="http://alabor.me/articles/request-response-oriented-websockets/">http://alabor.me/articles/request-response-oriented-websockets/</A>
</I>&gt;<i>     <A HREF="https://www.npmjs.com/package/primus-responder">https://www.npmjs.com/package/primus-responder</A>
</I>&gt;<i>
</I>&gt;<i> thanks for your help,
</I>&gt;<i> /Robi
</I>&gt;<i>
</I>&gt;<i> _______________________________________________
</I>&gt;<i> Extend mailing list
</I>&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A>
</I>&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A>
</I>&gt;<i>
</I>&gt;<i>
</I>-------------- next part --------------
An HTML attachment was scrubbed...
URL: &lt;<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20150624/6d15706e/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20150624/6d15706e/attachment.html</A>&gt;
</PRE>



<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000540.html">[99s-extend] Websocket vs. Request-Response msg pair
</A></li>
	<LI>Next message: <A HREF="000543.html">[99s-extend] Websocket vs. Request-Response msg pair
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#541">[ date ]</a>
              <a href="thread.html#541">[ thread ]</a>
              <a href="subject.html#541">[ subject ]</a>
              <a href="author.html#541">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>