diff --git a/client.coffee b/client.coffee index 34dbd81..ac6c712 100644 --- a/client.coffee +++ b/client.coffee @@ -44,7 +44,10 @@ class Client @.subscriptionManager.remove(routing_key) sendPong: -> - @ws.send(JSON.stringify({cmd: "pong"})) + try + @ws.send(JSON.stringify({cmd: "pong"})) + catch e + console.error("Error: ", e) close: () -> if @.subscriptionManager diff --git a/subscription.coffee b/subscription.coffee index 6f2b955..b5b887e 100644 --- a/subscription.coffee +++ b/subscription.coffee @@ -14,7 +14,10 @@ class Subscription clientMsg.routing_key = msg.fields.routingKey clientMsgStr = JSON.stringify(clientMsg) - @ws.send clientMsgStr + try + @ws.send clientMsgStr + catch e + console.error("Error: ", e) start: () -> queue.subscribe(@client_id, @routing_key, @.handleMessage.bind(@))