Mino
Mino

Reputation: 635

ActionHero js and custom websocket event

I am trying to use the websockets implementation of ActionHero.js. Looking at the documentation it's clear how to implement a chat, but I don't understand how is possible to emit a custom event from server to client and organizing a complex realtime app. I am looking at the primus-emitter project examples: https://github.com/cayasso/primus-emitter

Anybody knows? Thanks

Upvotes: -2

Views: 686

Answers (1)

Evan
Evan

Reputation: 3306

You can just call connection.send(message) on the server. In the client lib, the event message will be fired. So, client.on('message, function(m){ ... }).

Be sure to add some descriptive content to the message you send from the sever (like perhaps {"type": 'message type'}) so you can route message types on the client.

Upvotes: 3

Related Questions