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