Skip to content

channel disconnects and reconnects #27

@tfmcunha

Description

@tfmcunha

I'm having the same issue that has been previously reported but I was unable to fix..
I'm working on an app with chat feature and when the component is mounted, the channel is disconnected and reconnects(aparently).. the same happens with every key stroke while writing a message. On the terminal, everything is working fine, except for the messages informing of the channel being unsubscribed and again subscribed.
The problem is intermitent as sometimes I receive the broadcasted data from the server, and other times nothing comes through.

//request.js
import { ActionCableProvider } from 'react-actioncable-provider';
import ActionCable from 'actioncable';
const cable = ActionCable.createConsumer("ws://localhost:3001/cable");

<ActionCableProvider cable={cable}>
    <Chat request_id={this.props.request.id} selected={this.state.selected} sender_id={this.props.user_id} recipient_id={this.props.request.user_id}/>`
</ActionCableProvider>
//chat.js
<ActionCableConsumer
    channel={{channel: "ConversationsChannel",
		        	  conversation: this.state.conversation_id}}
    onReceived={this.handleReceived}
    onDisconnected={console.log("off")}
    onConnected={console.log("on")}
/>

full code @this repository

Any help will be extremly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions