Haz*_*ass 5 mobile ruby-on-rails ios swift react-native-ios
我正在使用react-native-actioncable开发一个简单的聊天应用程序但不幸的是它只在android中工作.
constructor(props) {
super(props);
let self = this;
self.App = {};
self.App.cable = ActionCable.createConsumer('wss://xyz/cable');
self.App.room_chat = self.App.cable.subscriptions.create({
channel: "ChatChannel",
room: "chat_1"
}, {
connected: function () {
alert('connected');
console.log("connected")
},
disconnected: function () {
alert('connected');
console.log("connected")
},
received: function (data) {
},
rejected: function (data) {
console.log("rejected", data)
},
sendMessage: function (message, id) {
console.log("sendMessage")
return this.perform('speak', {message: message, group_id: "chat_" + id});
}
});
}
Run Code Online (Sandbox Code Playgroud)
经过一番调查后,我发现问题是连接的回调从未被调用,这意味着我的频道甚至没有连接.这种行为仅限iOS.
我也厌倦了使用SWIFT/ObjectC并且它也没有用,我相信这个问题在我的后端,但不知道怎么办?
任何帮助!
| 归档时间: |
|
| 查看次数: |
275 次 |
| 最近记录: |