More robust websocket writting
parent
c4a95a3de9
commit
cb380d5cbc
|
@ -44,7 +44,10 @@ class Client
|
||||||
@.subscriptionManager.remove(routing_key)
|
@.subscriptionManager.remove(routing_key)
|
||||||
|
|
||||||
sendPong: ->
|
sendPong: ->
|
||||||
@ws.send(JSON.stringify({cmd: "pong"}))
|
try
|
||||||
|
@ws.send(JSON.stringify({cmd: "pong"}))
|
||||||
|
catch e
|
||||||
|
console.error("Error: ", e)
|
||||||
|
|
||||||
close: () ->
|
close: () ->
|
||||||
if @.subscriptionManager
|
if @.subscriptionManager
|
||||||
|
|
|
@ -14,7 +14,10 @@ class Subscription
|
||||||
clientMsg.routing_key = msg.fields.routingKey
|
clientMsg.routing_key = msg.fields.routingKey
|
||||||
clientMsgStr = JSON.stringify(clientMsg)
|
clientMsgStr = JSON.stringify(clientMsg)
|
||||||
|
|
||||||
@ws.send clientMsgStr
|
try
|
||||||
|
@ws.send clientMsgStr
|
||||||
|
catch e
|
||||||
|
console.error("Error: ", e)
|
||||||
|
|
||||||
start: () ->
|
start: () ->
|
||||||
queue.subscribe(@client_id, @routing_key, @.handleMessage.bind(@))
|
queue.subscribe(@client_id, @routing_key, @.handleMessage.bind(@))
|
||||||
|
|
Loading…
Reference in New Issue