现在,我基本上想把ActionCable的客户端部分实现到另一个不运行在Rails 5上的应用程序中,并将其与第一个应用程序连接起来以发送和接收数据(例如用户的在线状态或消息)。
为了从第二个应用程序发送数据,我认为可以简单地进行AJAX POST请求。问题是:如何从我的第二个应用程序订阅到第一个应用程序的开放连接?
甚至可以问:如何通过API从另一个应用程序订阅到我的Rails应用程序的ActionCable连接?
我猜测,我基本上想在我的第二个应用程序中以某种方式包含这个coffeescript代码:
App.appearance = App.cable.subscriptions.create "AppearanceChannel",
connected: ->
# Called when the subscription is ready for use on the server
disconnected: ->
# Called when the subscription has been terminated by the server
received: (data) ->
# ...
socket.io-client
连接到MeshRelayChannel
? - sreang rathanak