问题
Is there any way to send a status of request to client in ActionCable Channels?
For example, if sent data is invalid (or some unknown exception were raised) I want to error text in response message, otherwise send 'status: ok'. What I have on client side now is subscriber's perform method which returns true in almost any circumstances as we can see from source code (github):
send: (data) ->
if @isOpen()
@webSocket.send(JSON.stringify(data))
true
else
false
In websocket-rails gem there were methods for this: trigger_failure and trigger_success.
来源:https://stackoverflow.com/questions/39650446/how-to-send-the-status-of-websocket-request-in-actioncable