How to close connection in Action cable?

后端 未结 5 482
时光取名叫无心
时光取名叫无心 2021-01-12 10:59

How to disconnect a client in Action cable (rails 5)? I would like the user to be completely disconnected (similar to when he closes the tab).

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 11:26

    to disconnect from the client side (in js), call

    App.cable.disconnect();
    

    to disconnect from the server side - see the answer from @prograils

提交回复
热议问题