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.

Expanding WebSocket functionality on Heroku with Node.js

Imagine a scenario where I have a substantial application managing numerous websocket connections on Heroku. To handle this high demand, the number of dynos is increased to N. How does Heroku's router distribute these new incoming websockets connecti ...

Encountering a "DOM Exception 11: InvalidStateError" when attempting to use websocket.send

I encountered the following error message: DOM Invalidate exception 11 This error is coming from the code snippet below, but I'm having trouble identifying the root cause. /*The coding style may appear pseudo-stylish with potential syntax errors*/ ...

Unable to establish connection via web socket with SSL and WSS in JavaScript

Below is the code I used to implement web socket: try { console.log('wss://' + hostname + ':' + port + endpoint); webSocket = new WebSocket(webSocketURL); webSocket.onmessage = function (event) { //console.log('send mes ...

Fetching data in a sequential manner within a Server Component to manipulate a consistent data set in Next.js

Recently diving into the world of next.js (utilizing v13 with App Router), I find myself in search of guidance regarding a particular challenge I've been wrestling with. My objective is to dynamically render data on a page and incrementally update it ...

Create an mp3 file using the arrayBuffer functionality

Struggling with StackOverflow, I attempted to record audio from a Raspberry Pi using Node.js (1). The audio stream is then sent through a WebSocket server (code omitted for simplicity), where a Vue.js WebSocket listens to the stream. My goal is to save thi ...

Exploring the synergy of combining Actioncable with Rails 5 API mode

I am in the process of creating a simple chat application. The main objective is to utilize a Rails API backend and then develop clients for IOS, Android, web, and desktop platforms. This project is primarily aimed at exploring Websockets and mobile develo ...

When using Websocket, an error message stating "Invalid frame header" will be triggered if a close message of 130 or more characters is sent

I am utilizing the ws node.js module along with html5's WebSocket. The Websocket connection is established when a user triggers an import action, and it terminates once the import is completed successfully or encounters an error. At times, the error mess ...

WebSocket implementation performance evaluation

Update: I will now narrow down this question to focus on the essential information. Can someone provide a comparison of the performance in MB/s between the two websocket implementations mentioned below? No need for application or hardware specifics, jus ...

Which option is better for my needs: AJAX or WebSockets?

The ongoing debate between HTTP and WebSockets has resurfaced yet again, leaving me in a state of confusion even after sifting through numerous comparison blog posts, discussions on Stack Overflow, and other resources. As I evaluate the needs of our applic ...

Is it possible to utilize the npm package `twilio-chat` on the server side for Twilio Chat functionality?

Exploring a method to integrate Twilio with our backend by leveraging our custom web socket for an enhanced real-time chat experience. Is it possible to utilize twilio-chat through my web socket as a proxy server? ...

Node.js implementation for routing WebSocket requests from an HTTPS server to an HTTP server

I'm currently developing a Node.js proxy server that handles routing requests from a website to a local endpoint. The website has the capability to run either on a local server or in a cloud instance, so the proxy needs to be able to support both HTTP and ...

The customer opts to store all images indefinitely into the data stream

I have set up a node server that captures images from a webcam at regular intervals and sends them to the client using the Delivery.js node module. Upon monitoring the browser resources in Chrome development tools, it appears that each image sent is being ...

Develop a custom string router that does not rely on traditional methods such as http, cli,

I am facing an issue with my web socket connection where it sends me some params that I need to route as a string input in my node.js apps. After searching for solutions, I haven't been able to figure out how to handle this. I attempted using the "Directo ...

I'm having trouble with my useState in React/NEXTjs because it's not adding onto the result of a socket.io event from the server, it's simply

Frameworks used: Next.js, Socket.io, React I am currently working on a straightforward messaging application. The main concept involves emitting a message typed by a user, sending that message to the server, and then broadcasting it back to all clients th ...

a stand-alone Node.js application connecting to a self-signed WebSocket (WSS) server

I am currently working with a node server (Meteor.js) that needs to communicate with another server using websockets. Since the communication is strictly between servers and does not involve direct users, I have decided to use a self-signed certificate. I ...

Decoding the information received from Socket.IO within the Flash client

When utilizing server node.js and module Socket.IO, data transmission is handled as shown below: var tests = [555, 777]; client.send("Test string"); //first message client.send({tests:tests}); //second message If the data sent is a text string (fi ...

Using websockets in a React client application

Attempting to establish a connection with a backend layer running on localhost, here is the provided source code: const { createServer } = require("http"); const cors = require("cors"); const photos = require("./photos"); const app = require("express")( ...

What steps can be taken to resolve the error message "Echo is not recognized"?

Currently, I am handling a project with Laravel 7 along with Vue.js and Laravel-echo. The setup involved installing the Laravel Echo library using npm install --save laravel-echo pusher-js within my application. Additionally, the necessary code was include ...

How can the request object be obtained in a Node.js lambda function using Serverless Websockets?

Connecting my client application to the Websocket server using the URL: wss://xxxxxxx/xxxxx/xxxx?value=abcd The WebSocket server I'm working on needs to retrieve the value "abcd" that is passed by the client in the request URL. However, all I can find in ...

Comparing the Round-trip Time of AJAX versus Web Sockets

Can one expect a variance in round-trip time when using web sockets (message) versus a standard HTTP GET for sending information to the server and receiving a response? Assuming the web socket is already connected and DNS has been resolved. From my unders ...

Removing users from a Socket.IO chat room using Node.js

I am facing an issue with removing users from Socket.IO when their browser is closed. The 'user' in the array 'users[]' is not getting removed or updated. Additionally, I would like to update the users on the client side as well. Can someone assist me in r ...

Ways to block WebSocket access on a personal computer

Is it possible to protect my server resources from being accessed by other websites, such as example.com, via WebSocket? I want to prevent them from accessing the server using a URL like "ws://47.80.151.189:1234", and utilizing its resources (bandwidth, me ...

Is it important to keep track of the state change frequency in my React Redux application?

Currently, I am working on developing and evaluating a "real-time" web application using React, Redux, and Websocket technology. The data set on my server undergoes approximately 32 changes per second. Each change triggers an async message through Websock ...

Utilizing Express-WS app and TypeScript to manage sessions

I am currently working on setting up a node server using Typescript with the help of express and express-ws. My goal is to include Sessions in my application, so I have implemented express-session. Below you can find some pseudo code: import * as session ...

Establishing parameters in a Socket.io chatroom

I am encountering an issue when attempting to store information in the socket room variables. The error message I receive is: UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'host' of undefined This is the snippet of my code: io ...

Dispatch a websocket communication from a synchronous function and retrieve the information within the function itself

I am currently working on an Angular project and need guidance on the most effective approach to implement the following. The requirement is: To retrieve an image from the cache if available, otherwise fetch it from a web socket server. I have managed ...

Comparing Server Sent Events and Ajax with Websockets and Ajax

I am currently developing an application using Nuxt.js and facing challenges in determining the best approach for sending data to the API built with Express.js and receiving real-time updates. I have identified that "bi-di" connections can be established u ...

The value retrieved from the event handler function's state does not match the anticipated value

While debugging, I often minimize this particular component to understand its behavior later on. It was quite challenging to pinpoint the issue due to some intricate logic in place. Nonetheless: import { useContext, useEffect, useState } from "react&q ...

Running NODE.JS (Socket.io) on CENTOS 7 with SSL domain: Step-by-step tutorial

My project using socket.io called "xampp" runs smoothly on localhost. After transferring the files to my Centos 7 (cPanel) server, I launched the server by running the command "nodemon server.js". However, I am encountering SSL-related issues with the cli ...

What is the process for invoking a websocket from an HTML client?

I have created a WCF Service using netHttpBinding binding and it is hosted on IIS 8 (Windows Server 2012). The interfaces for the service are as follows: [ServiceContract(CallbackContract = typeof(IDuplexCallbackContract))] public interface IHelloWebSocke ...

Communicating between a Python Client and a nodeJS Server using Socket.IO

I am attempting to transmit data from my Raspberry Pi (using Python 2.7.9) to my NodeJS server with socket.io. My objective is to continuously send multiple values from my Pi through a websocket connection to my local Node Server, which will then display ...

What are the alternatives to using Node.js for implementing real-time chat functionality in core PHP using socket.io?

I am in the process of integrating socket.io into my core PHP custom framework. I prefer not to use node.js because it may cause conflicts with my existing AJAX code. 1) Is there a way to use socket.io without relying on node.js? 2) If node.js is necessar ...

Can WebSocket messages be encoded?

Is there a way to encrypt or obscure the data I transmit via websockets? For example, the message looks like this: var encryptedMsg = { type: "message", data: { message: "Hello world!" } } I require the ability to send this message in ...

Transmit messages from server (via Expressjs routing) to the client

I am looking for guidance on how to effectively send messages from the server to the client and incorporate this functionality into routes/index.js within my mean stack project. Can anyone provide insights on using socket.io in this context?: router.post( ...

Shortcut Express Lane and Socket io

Recently, I configured my socket io connection to send information to the frontend and receive responses from the client. The data is successfully saved as well. However, it seems unnecessary to initialize socket io in the server.js file when its function ...

The WebSocket function is returning undefined even though it successfully fetches the user; however, the user is

I've been experimenting with a websocket to retrieve user information. When I establish the connection and send messages to receive the data, it returns undefined when I try to use that information elsewhere. However, if I run console.log within the ...

Retrieve a specific item from a JSON response using Node.js

When I receive a message from a WebSocket, the code snippet is triggered like this: ws.onmessage = (e) => { debugger if (e.data.startsWith('MESSAGE')) alert(JSON.stringify(e.data)) ImageReceived(e.data) console.log ...

The function Server.listeners is not recognized by the system

Currently, I am following a tutorial on websockets to understand how to incorporate Socket.IO into my Angular project. Despite meticulously adhering to the instructions provided, I encountered an error when attempting to run my websockets server project: ...

Timeout when making an HTTP request

One question I have is regarding socket timeout in NodeJs. To address the issue, initially, I included the following code : req.socket.once('timeout', function(err) { imports.logger.warn('Express socket timeout.', err); res.status(504 ...

Is there a way to operate both websocket and http methods concurrently on a server in Typescript?

I have a question regarding running a websocket server with the route "ws://localhost:port" using the 'ws' library. It requires the app instance of 'express' and also features http routes such as "http://localhost:port/auth/login". I am looking for a solut ...

Incorporating AngularJS $watch and $interval functionalities into a communication platform

Currently, I am incorporating messaging into my angular application that interfaces with a rails backend. To create a sense of real-time communication, I have opted to utilize the $interval directive, which triggers calls to the server every 5 seconds to r ...

Exploring the potential of Angular2's WebSocket service by efficiently accessing the parent component

I need some assistance with implementing WebSockets in my angular2 application. However, I've encountered a minor issue that I can't seem to solve. Here's what I have so far: I've created a service that has a method for creating a WebSocket object. This m ...

Issue with Socket.io emit failing to work (when accessing a specific URL)

I am currently working on an application that requires receiving signals from external hardware equipment. These signals are captured by redirecting them to a specific URL in the app: '/impulse/:id'. Although I am able to capture the signal, it seems that ...

Having trouble passing AWS EMR Jupyter Notebook's socket through a node application. Unable to load kernel

We are facing an issue with our node application that serves as a proxy for the Jupyter notebook running on AWS EMR. While we can successfully proxy all HTTP requests using http-proxy-middleware, we are encountering difficulties when it comes to handling w ...

How can one effectively monitor the advancement of a file transfer operation?

Looking at integrating a Spring Boot REST API with an Angular Frontend, I am interested in monitoring file upload/download progress. I recently came across an informative article that dives into the implementation details of this feature. The approach see ...

Issue with dependencies resolution in Nest framework

While delving into NestJS dependencies, I encountered an issue. As a beginner in learning Nest, I am still trying to grasp the correct way to structure everything. The problem lies in Nest's inability to resolve dependencies of the ChatGateway. It&a ...

Is the sudden disconnection from Chrome after a WebSocket handshake related to a domain mismatch or is it possibly a bug in Chrome?

I created my own WebSocket server using Python, but I encountered an issue where Chrome 4.0.249.78 dev (36714) always disconnects after the handshake process. Wanting to rule out any issues with my code, I tested it using the WebSocket server from , only t ...

calling next() function in the express-ws library within a Node.js application

While exploring ways to establish a reliable Websocket connection between my web server and client browser, I found a sample code that utilizes express-ws. This code is configured to listen on port 3000 for websocket connections. var express = require('ex ...

What is the best way to transmit data through a web socket connection effectively?

When it comes to sending data over a web socket connection, is there an optimal method? In my specific scenario, I am transmitting data from a C# application to a Python (Tornado) web server by sending a string with multiple elements separated by commas. I ...

The Inverisfy Express utility seems to be having trouble connecting to the web socket server for socket.io

import 'module-alias/register'; import 'reflect-metadata'; import sourceMapSupport from 'source-map-support'; import { LIB_ENV_CONFIG, logger } from '@sn/shared'; import { AppServer, IExpressMiddleware, InversifyFactory } from '@sn/server'; import { AsyncC ...

NESTJS does not have any impact on enabling CORS

I am facing issues with enabling CORS for testing purposes in the latest version of NestJS 8.0.6 on a fresh http + ws project. I need to have the Access-Control-Allow-Origin header in the server's response for the client to accept it. I have tried thr ...

Jasmine: A guide to mocking rxjs webSocket

Here is my chat service implementation: import {webSocket, WebSocketSubject} from 'rxjs/webSocket'; import {delayWhen, retryWhen, take} from 'rxjs/operators; import {timer} from 'rxjs; ... export class ChatConnectionService { private readonly _connect ...

Javascript for Cordova utilizing WebSocket and incorporating client side certificates

I am looking to establish a secure SSL/TLS connection between my client and server, with only a specific authorized client allowed to connect. To achieve this, I have generated a client certificate using OpenSSL on the server for mutual authorization. The ...

Creating mappings for Websocket paths in Express

Is there a way to configure routes for Websockets using the ws library in an ExpressJS application? Setting up these two layers side by side seems simple, but the Websocket layer does not interact with ExpressJS middlewares (like authentication). The onl ...

Using Websocket-Node in the browser

Testing websockets with nodejs has been quite a journey for me, especially when dealing with hundreds of clients. I initially used the Websocket-Node module to enable websockets on node, but now I am facing difficulties testing this functionality on the br ...

Utilizing Node.js, establish seamless web sockets communication for linking a web application with a charging device

I'm in the process of developing an innovative application that involves using my web app as a remote control interface, a node-based web socket server as the central management system (CMS), and an electric vehicle charger as the end device. I am seekin ...

A Python subprocess function that triggers a callback when the output is updated

Currently, I am utilizing Tornado to handle a specific task. Essentially, the program is spawning a tcproute process and then sending the resulting output to the opposite end of the websocket. class TracerouteHandler(tornado.websocket.WebSocketHandler): ...

Tips for incorporating a multimedia HTML/JavaScript application within C++ programming

I possess the source code for a JavaScript/HTML5 application that operates on the client-side and manages the transmission/reception of audio and video data streams to/from a server. My objective is to develop a C++ application that fully integrates the c ...

Encountering an Error when Integrating Pusher (real-time data library) with Next.js: PusherRequestError - Unexpected status code 400

I encountered an issue while trying to integrate Pusher into my Next.js application due to Vercel's restriction on websockets in their serverless functions. The error message I keep receiving after running the program with Pusher is: error - unhandled ...

Using JSON communication with React Native websockets

I'm currently facing a challenge in setting up a Websocket client that communicates with a web server using JSON. Unfortunately, I haven't been able to find any useful examples online. The only code snippet I stumbled upon is : var ws = new Web ...

Tips for structuring your vuex store in conjunction with websocket mutations

Currently, I am utilizing vue+vuex+vue-native-websocket to manage my operations. As per the documentation's guidance on dealing with websocket messages using vuex, it is advised to utilize SOCKET_... mutations. At present, I tackle all incoming messages i ...

Memory leaks observed in BinaryJS websockets

Currently, I am in the process of developing a simple client/server setup to facilitate the transfer of image data between a browser and a node.js server using BinaryJS websockets. Despite following the API examples closely, it seems that my implementatio ...