react-native-actioncable not working with iOS

Viewed 350

I'm developing a simple chat app using react-native-actioncable but unfortunatly it's working only in 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});
            }
        });
}

After some investigation, I found that the issue is that connected callback is never called which means that my channel is not even connected. this behavior in iOS only.

I tired it too using SWIFT/ObjectC and it's not working too, I believe that the issue is in my backend but don't know how?

Any Help!

0 Answers
Related