You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. In Zappa, the server should be able to broadcast an event during a request handler. Presently (Zappa 0.2.0) the shortcut broadcast is only accessible in event handlers.
Example use case: When a tweet is HTTP posted, the server broadcasts an event to notify other browsers connected.
post '/': ->
t = new tweet({body: @text, date: new Date})
t.save()
broadcast 'tweet', {tweet: t}
client '/t.js': ->
connect() # an aside: connect() is neglected in the documentation
at tweet: ->
alert @tweet.body
Proposed solution: make broadcast a shortcut for io.sockets.emit in request handlers (and elsewhere).
Workaround: def io: io in the app's scope and then io.sockets.emit in the request handler.
The text was updated successfully, but these errors were encountered:
Now I'm using 0.3.1 . The bug still exists. Here's the updated workaround: io = @io in the app's scope and then io.sockets.emit in the request handler.
Hi. In Zappa, the server should be able to broadcast an event during a request handler. Presently (Zappa 0.2.0) the shortcut
broadcast
is only accessible in event handlers.Example use case: When a tweet is HTTP posted, the server broadcasts an event to notify other browsers connected.
Proposed solution: make
broadcast
a shortcut forio.sockets.emit
in request handlers (and elsewhere).Workaround:
def io: io
in the app's scope and thenio.sockets.emit
in the request handler.The text was updated successfully, but these errors were encountered: