Questions tagged [websocket]

WebSocket is a cutting-edge interface that leverages TCP sockets and an innovative protocol allowing seamless, two-way communication between clients and servers minus the burdensome HTTP overhead.

Header frame is not valid

I have been working on developing a real-time application using NodeJS as my server and Socket.IO to enable live updates. However, I encountered an error message that reads: WebSocket connection to 'wss://localhost:1234/socket.io/?EIO=3&transport=we ...

Various choices are available for designing a live notification system

Trying to figure out the most effective architecture for developing a real-time notification system. My app's journey: A React app triggers a POST API in Node, which updates the notification table. Here's where I'm stuck: Should another ...

Guide on establishing connections with multiple socket clients in nodejs

Imagine this scenario: I have a server where socket(1) runs, and another server where socket(2) client connects to socket(1). Additionally, I have one browser socket that connects to socket(1). The goal is to send requests from the browser and retrieve d ...

Node.js and Binary.js combined for a safe and secure WebSocket implementation

My current setup involves streaming an mp3 file using Debian Jessie, Apache, Node.js, and Binary.js. Everything works smoothly when using http:// and ws://, but I'm encountering issues when trying to make it work with https:// and wss://. Even though the s ...

WebSocket connection issues are being experienced by certain users

While using socket.io, I encountered an issue where some users were unable to send messages with the message "I can't send a message why?". After researching the problem, it seems that the firewall or antivirus software may be blocking websockets. If ...

Exploring the world of WebSockets and Socket.io

Recently many online games, like , have started using WebSockets to create real-time MMORPGs. I'm curious about how to develop a node.js program that can manage connections from browsers using WebSockets. Here is an example of browser code: <!DOC ...

What is the method for linking the ReactJS frontend socket client with the server-side socket?

I encountered the following issue while running my MERN app: WebSocket connection to 'ws://localhost:3000/socket.io/?EIO=4&transport=websocket' failed: WebSocket is closed before the connection is established. I am unsure of how to establish ...

Utilizing Node and Socket.io to transmit data periodically via websockets from a CSV file

I am relatively new to working with Node.js and Express.js. My goal is to set up a websocket server that can send CSV data at irregular intervals stored within the file itself, line by line. The structure of the CSV looks something like this: [timeout [ms] ...

WebSocket connection established on port 8888, while the web server is running on port 80 - incompatible to merge the two services

Here is some node.js server-side code that involves watching a file and sending modifications to the browser: var app = require('http').createServer(handler) , io = require('socket.io').listen(app) , fs = require('fs') a ...

Angular's implementation of a web socket connection

I am facing an issue with my Angular project where the web socket connection only opens upon page reload, and not when initially accessed. My goal is to have the socket start as soon as a user logs in, and close when they log out. Here is the custom socke ...

Can Node.js support the use of multiple websocket servers simultaneously?

I have a unique system that primarily runs on PHP for backend logic, but I also utilize Node.js for specific functionalities. Currently, my Node.js server serves as a websocket server and I am using Socket.IO to manage the sockets. Within the system, I ha ...

When there are numerous websocket connections in Google Chrome, Socket.io can encounter issues and break down

I am encountering an issue where I create 60 client connections to a socket.io server using Google Chrome browser. The server sends screenshots to the clients at specific times, but some of the websocket connections, which are subprotocols of socket.io, ge ...

There was a problem with the WebSocket handshake: the response header value for 'Sec-WebSocket-Protocol' did not match any of the values sent

I've encountered an issue with my React project that involves streaming live video through a WebSocket. Whenever the camera firmware is updated, I face an error in establishing the WebSocket connection. Here's how I initiate the WebSocket: wsRef.current ...

What is the best way to convert a JSON string received from Angular into a Java Object within a Spring

I am currently utilizing WebSocket to create a chat application. Below is the code from my Angular application that sends a MessageModel object to the backend after converting it into a JSON string: sendMessage(message: MessageModel){ let data = JSON.str ...

Utilizing perMessageDeflate with a websocket server in conjunction with express: A step-by-step guide

I need to configure a websocket server using perMessageDeflate and express. Currently, my configuration looks like this: const server = createServer({ cert: readFileSync('/path/to/cert.pem'), key: readFileSync('/path/to/key.pem') }) ...

How to enhance Node using Express for WebSocket pinging?

Currently, my project involves a game where players scan a QR code displayed on a TV screen. This action then initiates the controller on their smartphones and transfers player actions using websockets. In essence, it's simply transferring the value of a r ...

Exploring the Yahoo Finance Websocket with Angular

Upon visiting the Yahoo finance website (for example, ), I noticed that the page establishes a WebSocket connection. The URL for this WebSocket is wss://streamer.finance.yahoo.com/ I'm currently working on a small project where I need to retrieve dat ...

Creating delays in a Node.js server to replicate lagginess

I am currently working on developing a tool to replicate scenarios involving slow webservers. Inspiration behind creating a mock server Our frontend application communicates with 3 different webservers - X, Y, and Z all under the same domain. For example, ...

Is it possible for remote Node.js applications to communicate in real-time using full-duplex messaging via WebSockets

With no human involvement, both Endpoint A and Endpoint B are standalone Node.js applications operating independently. Endpoint A is tasked with establishing a secure web socket connection with Endpoint B and ensuring it remains active 24/7. Each endpoin ...

Dealing with Media Recorder File Types in FastAPI WebSockets - Trouble with Video File Integrity问题

Currently, I am working on a project that involves using FastAPI to manage WebSocket connections for receiving video blobs from a Media Recorder. The main objective is to divide the video into parts with a size limit of 5 MB and save each part as a separat ...

Socket IO: Error - The call stack has exceeded the maximum size limit

Whenever a client connects to my node.js server, it crashes with a 'RangeError: Maximum call stack size exceeded' error. I suspect there's a recursive problem somewhere in my code that I can't seem to find. This is the code on my server: require('monitor ...

The HTML document is having trouble establishing a connection with socketio

I currently hold an HTML file within my local file system, presented as follows: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example of a Minimal Working File</title> ...

Issues with connecting to server through Angular websocket communication

I deployed the server on an Amazon AWS virtual machine with a public IP address of 3.14.250.84. I attempted to access it using Angular frontend like so: public establishWebSocketConnection(port : number){ this.webSocket = new WebSocket('ws://3.14.250.84:' ...

Change the websocket origin to localhost in a javascript setting

My server is hosting the domain example.com. Every time a user loads a page on this server, it utilizes a WebSocket client in JavaScript to connect to another WebSocket server. However, the other server has CORS enabled, which prevents the connection bec ...

My goal is to transfer information from the client-side to the server-side upon the user disconnecting from a socket.io connection using Node.js

Is there a way to transmit data from the client side to the server side when a user disconnects from a socket.io connection in Node.js? I attempted creating a new event and calling it within the 'disconnect' event, but it seems impossible since the conne ...

React+vite application is unable to establish a WebSocket connection with a Spring Boot backend server

My React + Vite application is running on localhost:5173 port, while my Spring Boot is running on localhost:5729. Here is the code snippet from the App.jsx: import { useState } from 'react' import './App.css' function App() { const [list, setList] = use ...

Is Implementing a Promise for Preprocessing in NodeJS Worth It?

Looking to achieve the following using NodeJS + Express: Client sends a post request with JSON document data={text: "I love Stackoverflow", shouldPreprocess: <true or false>}; Need to call an external WebSocket service for sentiment analysis on the ...

Is Microsoft currently developing or backing any solutions that can enhance the scalability of AJAX Comet technology?

There seems to be a lot of discussion surrounding ajax comet in various questions and articles. I came across some information suggesting that it may not be very scalable with ASP.Net, but there are links available to enhance its scalability. I am curious ...

Socket.io is notorious for making recurrent XHR requests

Whenever I establish a connection to the server socket from the client side, specifically using React, I notice that the socket client sends repeated requests every few seconds. These requests are primarily of the "get" type and often end up in a pending s ...

System reboots upon socket message reception

I am currently working on developing a chat application using Next, Express, and Socket.io. I have encountered an issue where the state managing the messages in the chat resets every time a new message is sent from one browser to another. You can see an ex ...

What are the steps for creating a Post, Put, or Delete request before fetching with a Get method?

Currently, I am faced with a challenge while using a websocket server to access data from an ExpressJS API. Whenever I perform a fetch operation that updates the database (Postgres) followed by a GET request, the new record is not being included in the res ...

Establish a WebSocket connection via Meteor.js

How do we establish a Websockets connection in Meteor? Can we achieve this using the following code: ws = new WebSocket('ws://localhost/path'); ws.on('open', function() { ws.send('something'); }); ws.on('message&apo ...

Using NodeJS to manage multiple paths for WebSocket connections

Greetings, I am currently working on creating a WebSocket server class with multiple paths. I have encountered an issue where the connection Event is successfully emitted when calling the websocket server with a valid path, but the message Event does not s ...

What are the best practices for securely storing a distinctive client identifier for websockets?

In order to differentiate and identify the specific client sending a request through web-sockets, I require a unique client identifier. However, I'm uncertain about the optimal method for storing this identifier so that it can be included with every subseq ...

Utilizing AWS Websockets with lambda triggers to bypass incoming messages and instead resend the most recent message received

I am facing an issue when invoking a lambda that sends data to clients through the websocket API. Instead of sending the actual message or payload, it only sends the last received message. For example: Lambda 1 triggers Lambda 2 with the payload "test1" ...

What are the available events offered by Express websockets?

I am interested in learning about the different websocket events available. Currently, I have only used the ws.on('message') event, but I would like to find out how to detect when the connection is established and closed. I attempted to add the ws.on('conn ...

Using JSON data in an ArrayBuffer with TypeScript

I am currently struggling with converting the received ArrayBuffer data from a server via Websocket into another format. Below is the WebSocket code snippet: let ws = new WebSocket('wss://api.example.com/websocket'); ws.binaryType = 'arraybuffer' I am ou ...

The Mystery of Socket.io Random Disconnects (version 1.0.6)

Currently, I am utilizing the most recent version of socket.io (1.0.6) to develop an online multiplayer game using Phaser and Node. One issue that has arisen is that after the clients connect, they will sporadically disconnect without any specific pattern. ...

Even after unsubscribing with mqtt.js, the old listener continues to receive messages

Currently, I am utilizing mqtt.js to receive websocket data from an MQTT server. The subscription process is functioning properly, but the challenge lies in changing the topic dynamically by modifying the websocket configuration. The issue arises when, eve ...

Stop processing the current websocket connection once a new websocket request is received

Currently, I am utilizing the npm ws module (or its wrapper named isomorphic-ws) for establishing a websocket connection. NPM Module: isomorphic-ws This setup allows me to retrieve an array of data from a websocket++ server situated on the same local mac ...

Retrieve the post content without using bodyparser

I have been attempting to send a base64 encoded image to my express server and process it there to save it to disk. I want to achieve this using a simple HTTP POST request, but so far I have not been successful. Previously, I had a solution that involved a ...

Start a websocket server using Next.js (magic server)

I am currently working on developing a Next.js application that involves collaborative editing functionalities. In order to achieve this, my plan is to integrate The TipTap/HocusPocus library. Although I have successfully implemented TipTap in my Next.js ...

Implementing websocket functionality in Yii framework

I am currently working on integrating websocket functionality into my web application using PHP and as an extension for Yii. This will allow me to create a notification system similar to what I have in mind. My starting point is the code available at the ...

Can anyone provide guidance on how to properly decode pusher.com's "serialized" JSON data into a QJsonDocument in Qt5?

Having trouble parsing JSON data received from a pusher.com WebSocket in my qt5 application. After identifying the issue, I'm unsure of how to resolve it: To illustrate, I created a small test program: QString str1 = "{"event":"message","data":"{ ...

exploring the capabilities of sockets in PHP, reminiscent of the functionality found in Node.js

I recently downloaded and tried out a basic chat app with Node.js: https://github.com/socketio/chat-example The app is functioning properly. The server-side code is quite straightforward: var app = require('express')(); var http = require('http').Serve ...

Creating unique message formats for communication between a python client and a socket.io node.js server

Currently, I am attempting to establish communication between a Python client and a Node.js server using Socket.io 0.7. My goal is to send a custom event from the client to the server. To achieve this, I have been referencing the Socket.io documentation o ...

How to access multiple cryptocurrency data using Binance's WebSocket API

Requesting assistance on fetching websocket data for multiple cryptocurrencies import websocket, json pairs = ['fxsusdt', 'bnbusdt', 'btcusdt'] socket = 'wss://stream.binance.com:9443/stream?streams=bnbusdt@kline_1m&a ...

Guide on routing a websocket connection through a proxy server

Encountering an issue with github.com/facebook/create-react-app, particularly when proxying the webpack-dev-server with a custom server. While HTTP requests work fine, WebSocket requests fail with this specific error: WebSocket connection to 'ws://localh ...

New alternative for websocket-server in BrowserQuest

I am currently in the process of setting up Mozilla's BrowserQuest, but I have encountered a roadblock. The game relies on the now deprecated websocket-server node package, which has been removed from the npm library. In an attempt to find a solution, I a ...

Socket IO issue: CORS policy is blocking access to XMLHttpRequest

My application recently encountered an error. "Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." When connecting to socket.io, I haven't ...

Establishing numerous websocket connections within a singular application

I am looking to conduct load testing on our websocket service. Is there a method to establish multiple websocket connections from one workstation? My attempt with npm ws and websocket modules in conjunction with NodeJS was successful for a single connecti ...

What other ways can websockets be utilized besides comet?

Websockets offer a more efficient solution for comet (reverse Ajax, often achieved through long-polling). However, are there other ways we can utilize websockets? For instance: - Can websockets be used to facilitate communication between different bro ...

The WebSocket connection in the browser, when accessed through a remote server, typically shows a CLOSED state in the readyState property during the on

Local server operations are running smoothly. However, when testing on a remote server with Nginx, the issue arises where the readyState inside the event handler onopen is consistently showing as CLOSED. Nginx configuration: server { server_name doma ...

Capture (and perhaps reject) incoming web socket upgrade requests

I am facing a challenge with my Node.js server as I send a web socket upgrade request. The Authorization header in the request contains login information that needs to be validated against a database entry before allowing the connection. To prevent potenti ...

Error message "Uncaught ReferenceError: io is not defined" is displayed by Socket.io

I've been working on integrating sockets into my app, but have run into an error https://i.stack.imgur.com/4lUF7.png Interestingly, when I tested the socket functionality in a separate test app using the same code, everything worked perfectly. However, wi ...

Node.js Express is successfully receiving messages from the WebSocket server but encountering difficulties when attempting to send them out

My setup involves websockets with AWS API Gateway, an EC2 instance running Node.js and Express with WS websockets. I can send a message from wscat to the API Gateway WSS URL and it shows up in the EC2 instance. However, when I send a message from the EC2 i ...

WebSocket cannot establish a connection with any address besides 127.0.0.1 or localhost

I built a test app that consists of both an HTML5/WebSocket client and an HTTP/WS server. The servers are written in C#, with my own simple HTTP server and a WS server based on concepts from . The HTTP server listens on 0.0.0.0:5959, and the WS server is l ...

Issues with injection of angularjs, sockjs, and angular-sockjs are causing functionality to not

As a newcomer to technologies like angular, sockjs-client, and cyclone, I've encountered an injection issue while attempting to utilize a component created by bendrucker. The component in question can be found at this link: https://github.com/bendrucker/an ...

User access is managed through websockets

Currently, I am integrating Websockets into my php project using Ratchet and Symfony. Upon user login, they are automatically connected to a specific channel within the websocket connection. Messages can be pushed to the channel and displayed on the client ...

Challenges with Apollo GraphQL: Struggling to get the GraphQLWsLink (Subscriptions) to work with Next.js due to issues with the WebSocket implementation

Recently, I set up a GraphQL server in Go by following a tutorial closely. My front-end is developed using Next.js and I'm currently working on creating a client to connect to the server. Despite referring to the subscription docs thoroughly, I can&ap ...

What is the best choice for a Geolocation App: REST API or Socket.io?

Currently, I am working on a project that involves tracking moving cars. I am contemplating whether to update the location every time it changes and send it over through the socket. Alternatively, would it be more efficient to create a REST API where the ...

Exceeding the maximum number of concurrent connections with Pusher caused issues

As I work on developing a real-time chat application using the Pusher library in Next.js, I encounter an issue with multiple concurrent connections being created while exploring the website. Upon reading an article by Pusher titled Why Am I Seeing More Ch ...

proper integration of socket.io

I have been experimenting with socket io for my project to display online friends, and I have noticed an issue that seems strange to me. Every time the page is rerendered (whether due to a user changing their profile information or sending a friend request ...

Having trouble receiving a response from the websocket using RxJS in Node.js with Angular

Currently experimenting with setting up a WebSocket using rxjs webSocket I have managed to create a node server without any errors, but it is not sending messages to the server or connected users When I switch to 'ws://echo.websocket.org/', I can see mes ...

The JSON object, which has been converted into a string and sent over the network,

Attempting to set up a websocket server using TypeScript in Node.js, the following code was used: ws.on('message', (msg: string) => { console.log("got message:" + msg); const m = JSON.parse(msg); console.log(m); ...

Unable to establish communication between server and client using socket.io in conjunction with NodeJS, ReactJS, and Express

After reviewing various sources like blogs and videos, it seems that establishing a successful connection between the server and client is achievable. However, I am encountering difficulties implementing this on my own system. Below is the code snippet fo ...

The websocket server implemented in Node.js with the use of the "ws" library is exhibiting a peculiar behavior where it disconnects clients at random intervals,

My WebSocket server implementation is quite simple: const WebSocket = require('ws'); const wss = new WebSocket.Server( { server: server, path: "/ws" }); wss.on('connection', function connection(ws, req) { console.log("Connected"); ws.on('mes ...

Leveraging TipTap.dev for building a joint editing platform -

I have integrated the collaboration feature from tiptap.dev into my NextJS application. Initially, I used their CLI command for the Hocuspocus server which worked well on port 1234 locally and synchronized text editing across browsers seamlessly. However, ...

Guide on creating a Django channel consumer that can send replies asynchronously

When using my consumer, I utilize multiple reply_channel.send methods: > def ws_message(message): > line = get_output() > message.reply_channel.send({ > "text": line, > }) > line = get_output() > messag ...

Verifying user login on NodeJS through connection from an IIS-hosted website

I am currently upgrading an outdated CMS system and looking to implement a real-time chat feature. The existing CMS operates on IIS, MSSQL, and PHP. The chat feature will be hosted on a separate Linux box running Node.js and Socket.io After successfully ...

Setting up a Node.js WebSocket server on a shared cPanel hosting environment

Recently, I obtained a shared hosting plan with cPanel support for nodejs applications. Through the "Setup Node.js App" feature, I am able to define and set up a node.js app on my server. My goal is to create a websocket, and fortunately, they have opened ...

The type does not meet the requirements set by the class it is inheriting from

Currently, I am in the process of working on a WebSocket Secure (WSS) server utilizing the Node ws library which can be found here. More specifically, I am following the approach outlined in this particular question, although its relevance is yet to be det ...

Struggled with setting up the WebSocket structure in typescript

Issue Running the code below results in an error: index.tsx import WebSocket from 'ws'; export default function Home() { const socket = new WebSocket('ws://localhost:1919/ws'); return ( <div>Home</div> ); } ...

dispatch a WebSocket message within a route using Express.js

The Objective: Imagine a bustling marketplace with multiple shops. I'm working on a dedicated page localhost:3000/livePurchases/:storeId for shop owners to receive real-time notifications whenever they make a new sale. https://i.stack.imgur.com/VdNzjm.pn ...

Error Code 1002 on WebSocket Closing

I have developed an application that utilizes web sockets to establish communication between the server and client. In the event that the client's version is outdated (too old) and cannot interpret or handle messages correctly, I would like to address this ...