All Questions
43
questions
79
votes
3
answers
65k
views
Proper way of using React hooks + WebSockets
I need to connect to WebSockets server and log it's messages. With React class component I'd put this logic in componentDidMount lifecycle hook and move on happily, but I'm not sure how to properly ...
6
votes
1
answer
14k
views
Socketio implementation with FastApi and React
I have the following techstack
FastApi - backend
React - frontend
and want to implement socketio(not Websockets provided by FastApi). It lacks documentation in both FastApi and Socketio
2
votes
1
answer
4k
views
AWS API Gateway WebSocket API: how to use it with React / NodeJS / native WebSocket?
I am building my app:
Frontend: ReactJS / Javascript Native Websocket:
In my component that uses websocket:
useEffect(() => {
const orgId = localData.get('currentOrganizationId');
const ...
16
votes
5
answers
43k
views
how react js acts as a websocket client?
I want to create a Websocket based client-server Application. In that I'm created node js websocket server which is waiting for the clients. Now I want to create react js websocket client. I'm using ...
8
votes
3
answers
6k
views
Sending cookies with react native websockets
So I'm using react native websockets but cannot figure out how i can include cookies in websockets, any suggestions?
1
vote
1
answer
7k
views
Uncaught (in promise) DOMException: Could not start video source , Uncaught Error: The error you provided does not contain a stack trace
Hey guys am trying to run a webrtc video call using react, node, socket and peerjs, if i try starting a video chat with chrome it works, if i run chrome as private and connect as second user using the ...
-1
votes
2
answers
276
views
web socket url with domain name of backend container but doesnot resolve into ip of backend container
i made a docker container for react app and another for django app . now when i make a websocket call
const socket = new WebSocket(
// `ws://${WEB_SOCKET}:${WEB_SOCKET_PORT}/ws/lobby/`//this ...
22
votes
4
answers
15k
views
How to run socket.io in the background on iOS in a React Native app?
I am using socket.io in an iOS React Native(v0.20) app. The app tracks my location, and when my position changes it emits a message to a server. If the socket connection is lost the server sends an ...
17
votes
6
answers
22k
views
Reactjs: how to share a websocket between components
I'm new to React and I'm having some issues regarding components structure and sharing a websocket between them.
The app consists of categories and products. The initial data load will be done with ...
16
votes
2
answers
18k
views
state inside useEffect refers the initial state always with React Hooks
Every time I emit a message from another component, I can't get the full list of messages. Here is the hook and view component:
export function useChat() {
const [messages, setMessages] = useState([...
9
votes
3
answers
15k
views
WebSockets in Create React App with Webpack proxy
I created my React app using Create React App in version 3.1.2 (19 Sept 2019). I was trying to configure proxy for Web Socket requests, but it seems that when I am using the proxy, the connection is ...
9
votes
2
answers
6k
views
How to test Websocket Client with Jest and react-testing-library
I'm using create-react-app, Jest and react-testing-library for the configuration of the chatbot project.
I have a React functional component that connects to a WebSocket server and DOM changes ...
8
votes
2
answers
28k
views
Error during WebSocket handshake: Unexpected response code: 302
While connecting to REACT based WebSocket client to Java Jetty based Web Socket server, I am getting the error below -
WebSocket connection to 'ws://localhost:2319/ws' failed: Error during WebSocket ...
8
votes
2
answers
3k
views
Why ReferenceError: setImmediate is not defined, when I'm not using it at all?
I've created a tiny app with React and Nest, to understand WebScoket api.
Not to just waste time, I wanted to wrap it as a deployable app, and host it somewhere.
The code is here: https://github.com/...
7
votes
1
answer
5k
views
Update React state via Socket.io
My React component uses data from socket.io as it's state.
I am unsure how to just update the state when the data is updated without re-rendering the entire component.
Example code.
var socket = io(...