websockets without actionheroClient.js

77 views
Skip to first unread message

Clay Himmelberger

unread,
Oct 24, 2014, 9:30:46 AM10/24/14
to action...@googlegroups.com
Would anyone have advice about how to connect a web socket to actionhero without using actionheroClient.js? 

Our software client will be Unity3D, and we'll talk to an ActionHero server. They want some real-time updates as well, so a WebSocket connection what we'll use. However, I find it unlikely that they will use the actionheroClient.js file and I'd like to have an example they can use to test the web socket connections.

A new AH project has the `ws` dependency, and I tried their docs to connect, but it wasn't that simple to connect to localhost:8080. (snippet from their docs below).

Whatever software library is chosen for the client app, I'd be looking to make the actionhero server able to communicate with it. Has anyone else made a web socket connection that didn't use actionheroClient.js?

Thanks,
Clay

wscat against echo.websocket.org

$ npm install -g ws
$ wscat -c ws://echo.websocket.org 
connected (press CTRL+C to quit)
> hi there
< hi there
> are you a happy parrot?
< are you a happy parrot?

Evan Tahler

unread,
Oct 24, 2014, 1:20:25 PM10/24/14
to Clay Himmelberger, action...@googlegroups.com
Cool! Let us know when the game is released!

In general, implementing WS outside of a browser is fairly challenging.  I know that one of the transports you can choose, Faye, has been re-written for IOS [[ https://github.com/m1entus/MZFayeClient ]], but that's the only one I'm aware of.  Unfortunately, the Primus wrapper around the WS transport does add significant complexity (check the generated actionheroClient.js lib).  The actionehro-specific code is fairly small https://github.com/evantahler/actionhero/blob/master/client/actionheroClient.js.

Since you are making a game, why not connect over the TCP/TLS transport directly? 

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

Evan Tahler

unread,
Oct 24, 2014, 1:21:24 PM10/24/14
to Clay Himmelberger, action...@googlegroups.com

Clay Himmelberger

unread,
Oct 24, 2014, 2:03:30 PM10/24/14
to action...@googlegroups.com, clay.him...@gmail.com
Thanks for the reply. 

I'll have to see what they have available.  I was hoping to get a simple web socket client working (like my original post, that `wscat` command-line util) to show the game guys, but I think AH is already set up to handle web sockets a particular way. That team loves making games, but the server-side is kind of an afterthought, and I want to get the transport working sooner rather than later. I think Unity3D can run some javascript, maybe they can import or convert actionheroClient.js . . .

The TCP is a good idea too, that might be a fallback option. 

Will definitely keep you all posted (especially if we figure it out : )
Reply all
Reply to author
Forward
0 new messages