connecting a non-SocketStream WebSocket client to SocketStream server

97 views
Skip to first unread message

Davis Ford

unread,
Apr 29, 2013, 3:57:40 PM4/29/13
to socket...@googlegroups.com
So, I have a SocketStream server, which has a nice Web UI client, and all that works great.

In the Web UI a user can input a message into an input form, and push a button which sends the message via ss-rpc to the server, and then the server does:

ss.publish.channel('my-channel', 'event', data);

So, I'm publishing to a specific WebSocket channel via socket stream.

Now, I have other clients that are not served from this server via SocketStream -- they are standalone apps that run in an embedded WebKit browser environment, and I want to connect them to the same server, and be able to receive these events and participate in the WebSocket channel.

The WebSocket URL in Chrome Inspector looks something like this:


If I want to write a client that can connect to the server and subscribe to a particular channel without the SocketStream client code -- how might I go about it?

Just doing something like this:

ws.onmessage = function (evt) { console.log(evt); }

Does not seem to work, and it isn't clear to me the URL structure here, since all SocketStream web sockets seem to use the same general URL path of ws://host:port/{engine.io | socket.io}/default/?queryparams

For pub/sub channels -- I guess the channel info is embedded in the message payload -- since it does not seem to be embedded in the URL. Is that correct?


Owen B

unread,
May 12, 2013, 11:49:40 AM5/12/13
to socket...@googlegroups.com
Hey Davis

Sorry for the late reply. Can you clarify if you're using 0.3 or 0.4 here? For 0.4, the you'll be able to run the Prism client on your external devices and talk to the server directly that way.

Owen

Davis Ford

unread,
May 13, 2013, 9:52:07 PM5/13/13
to socket...@googlegroups.com
Hi Owen, you can disregard -- I ended up using Prism, and aside from the same-origin issue (which I sent a pull request on), it worked very well.

--
You received this message because you are subscribed to the Google Groups "SocketStream" group.
To unsubscribe from this group and stop receiving emails from it, send an email to socketstream...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Reply all
Reply to author
Forward
0 new messages