Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Integrating a websocket library Accessible to all components
Post Body

I'm looking for help on best practices for integrating a websocket library throughout my react project. It's not a generic ws library, it's designed specifically to talk to ROS (roslibjs). It requires a setup constructor to establish a connection, then multiple callbacks for when the connection has been established or if there were any errors.

I initially created a hoc component that does this all in componentdidmount and sets willupdate to false. I was originally going to make class functions do some of the websocket message sending/receiving however this would have required some 10-12 levels of prop drilling. I'd like to make it so a button way down the chain can send a websocket message.

I just want a good idea on how to structure this, best practices, whether or not I'm thinking this out wrong etc. I'm happy to use something like Redux but have avoided it until I needed.

Author
Account Strength
100%
Account Age
14 years
Verified Email
Yes
Verified Flair
No
Total Karma
10,059
Link Karma
2,441
Comment Karma
7,600
Profile updated: 4 days ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
6 years ago