Questions tagged [sockets]

An inter-process communication endpoint that supports bi-directional data flow. Although commonly used in network connections, it can also be implemented in various other contexts. It should not be mistaken for WebSocket, a specific protocol, or any other abstractions like socket.io.

Getting a 400 Bad Request error while trying to send JSON data to a PHP page via socket

Currently, I am in the process of developing a program that can gather temperature and humidity data from a Pysense device and then store this information in a database on my laptop. To accomplish this, I have set up a socket to send Json data via POST to ...

The Art of Securing Connections in Socket.io

Today, I am embarking on the journey of authenticating a connection through socket.io. The first step involves authenticating the user via a REST API. Once authenticated, I send a JsonWebToken containing the user's username to the client. However, be ...

The attempted decoding of a JSON object was unsuccessful. The provided JSON is not valid

I've encountered an unusual issue In my program, I am sending a JSON string through a socket: json_string = JSONEncoder().encode({ "id_movil": str(id_movil), "correo": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8 ...

What specific Python error is triggered by the message 'OSError: [Errno 98] Address already in use'?

I'm currently developing a simple Python TCP socket server. I am looking to handle a certain exception mentioned earlier in my code. Can anyone provide guidance on what should be placed after except in order to achieve this? ...

Resolve CORS issue in Socket.io when working with Node.js, React, and Socket.io

We have implemented CORS to allow requests from all origins. app.use(cors()); The server is running on port 4000, while the client is running on port 3000. Below is the code snippet from my server.js file: const cors = require("cors"); const http = req ...

Is there a correlation between the length of the first argument in the socket.emit function of socket.io and latency?

I am intrigued by whether there is a distinction, other than readability, between code snippets like: socket.emit('m','something'); and socket.emit('chat message','something'); Is switching from the second option to the first substantial enough in redu ...

What is the best way to access a private class variable within the sockent.on function in Angular?

export class AppComponent { title = 'my-app'; constructor(private notifyService : NotificationService) {} ngOnInit() { socket.on("laravel_database_chat:test", function(message){ //I AM ATTEMPTING TO INVOKE THE NOTIFICATION SE ...

Guide to adding server action listeners in a Vue.js application

I am currently working on developing a straightforward chat application using vuejs and socketio. My goal is to send messages from one user to all other users in the chat. Below is the code I have implemented on the server side to achieve this: io.on(&apo ...

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 writing to a PHP socket followed by reading, the socket becomes blocked

One issue I am facing is having a Java server listening to requests while a PHP page is sending those requests. After connecting to the server, I use the "socket_write" command to send something, and then attempt to read the server's response with "s ...

Establishing a secure Firebase connection with several Node.js instances via an AWS/ALB load balancer and Nginx

Looking to establish a connection between Firebase and a Node setup deployed on AWS/Elastic Beanstalk. The architecture includes 1-4 Node servers operating behind an ALB load balancer and Nginx proxy. Because Firebase requires WSS protocol, the ALB is nece ...

There was an issue when attempting to write to the nodejs socket due to an error: TypeError - the data provided is invalid, as the chunk must

When using electron, I encountered an issue while trying to write out some bytes on a TCP socket. Despite converting to a buffer with Buffer.from before calling write, I still received the error mentioned above. To simplify the situation, I narrowed it dow ...

Checking the validity of an HTTP response using Python

I am currently in the process of creating a basic web server and I have written a Python function to handle requests. Here is what it looks like: def handle_request(client_connection): request = client_connection.recv(1024) print(request.decode()) ...

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 ...

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 ...

Issue encountered: Unable to establish successful private messaging functionality with NodeJS Socket.io

I've been having trouble for more than a week now while developing my chat app that allows users to send private messages. Unfortunately, the private message function is not working properly. Let me provide you with the code that I'm using when a user wan ...

Redux toolkit does not synchronize with Socket.io

Imagine a scenario where you have developed a chat app similar to WhatsApp Web. In this app, the chat section displays all chats on the left and in the middle. Upon user login, the first contact is saved in the Redux store as selectedChatUser. All the cha ...

(IONIC 2) Issue: error when trying to integrate socket.io with express, receiving a 404 (Not Found) error when attempting to connect to http://localhost:3000/socket.io/?EIO=3&transport=polling&t=LvraMV

I encountered an issue while attempting to connect my node server with Ionic2, Here is some background information: 1. I am developing the node server on my personal laptop. 2. When running 'ionic serve', everything functions normally without any issues. ...

Which specific file do I need to update for Socket.io configuration when working with Express?

I have organized my app skeleton using express-generator, but I am facing an issue with setting up the socket.io code because my server and routes are in separate files. Most tutorials have everything in one file. The contents of app.js: var routes = req ...

The functionality of sockets is currently experiencing issues on the production environment when used in conjunction

I'm having trouble getting my angular project to work on production. Sockets are not functioning properly when I deploy the project on my Ubuntu 20.04 server. Everything works fine on localhost, but when I access the website on my server, I get an ERR_CONN ...

"Encountering a socket connection error (ECONNREFUSED) in a Node application deployed on

Getting ECONNREFUSED error when attempting socket connection in Node app on openshift servers, but works fine on local machine. Hello there! I am currently working on a simple application that requires making an outgoing socket connection from my server.j ...

Unable to successfully upload a file in nestJS due to unreliable network conditions

I have successfully set up a controller with a route for file uploads using axios. The implementation includes utilizing FileInterceptor. Everything functions properly, however, when I enable network throttling in the browser, the uploader ceases to work. ...

When attempting to use the node.js REPL over a socket, the connection will unexpectedly terminate if the user presses CTRL + C

As I attempt to utilize REPL over a socket in a manner similar to a telnet connection, I have encountered an issue whereby pressing CTRL + C or CTRL + D, or encountering an error result in the socket connection becoming unresponsive. The code written in n ...

Unleashing the Power to Sever a Connection in Node.js

For my school assignment, I've been tasked with creating an http server using only native modules in node. To ensure that the server doesn't get overloaded, I implemented a method where each request is hashed and stored. Once a specific request exceeds a c ...

I am attempting to establish a connection with the Converge Pro 2 system from Clearone using NodeJS node-telnet-client, but unfortunately, my efforts to connect have been unsuccessful

My connection settings are as follows: { host: '192.168.10.28', port: 23, shellPrompt: '=>', timeout: 1500, loginPrompt: '/Username[: ]*$/i', passwordPrompt: '/Password: /i', username: 'clearone ...

"Utilizing Node.js with Socket.io and Express version 3 for dynamic web

I am new to Node.js and Express, and I am facing an issue with accessing the socket.io object in other modules. I tried creating a global variable to hold a socket object, but once the connection is closed by the user, the socket becomes unavailable. Altho ...

Obtaining the TCP Socket ID Upon Establishing Connection with the Server

One question I have is, How can I retrieve the TCP Socket Id when it's connected to the server? Here's the code snippet I am working with: const net = require('net'); const server = net.createServer(); server.listen(port, host, async( ...

What is the best way to incorporate real-time push notifications on my website?

My website consists of two main parts. One part is utilized by individuals labeled as X, while the other is reserved for those identified as Y. When a person from group X requests assistance, members of group Y promptly respond with an estimated time of ...

Tips on integrating Socket.io with Express?

I've written the Express code in my server JS file: app.post('/confirm', function (req, res) { // Currently struggling to send a socket using emit() }); Here is the Socket.io code I have: io.on('connection', function (client) { // Implementing all ...

Challenges with utilizing raw sockets in Node.js

I am currently using Windows 10 Version 10586 and node.js Version 4.4.5. While trying to implement the raw-socket module following the example provided on this page: https://github.com/stephenwvickers/node-raw-socket Upon running the code snippet below: ...

Utilizing numerous JSON entities within an AS3 socket

When receiving JSON data from a camera through a Socket, I encountered an issue. The received data contains two JSON objects in the socket. Is there a way to separate them before decoding? This is the error message I receive when trying to decode the J ...

Angular does not receive events from Socket.io

Recently I started coding with AngularJS and decided to build a real-time app using Socket.io: The service I'm using shows that the connection is fine on the console. Here's a picture of the Console.log output However, when I attempt to emit c ...

The keep-alive attribute in the Connection header is failing to maintain the socket connection for HTTP requests in a NodeJS environment

I recently learned about the Connection:Keep-Alive header, which supposedly instructs the server to maintain the connection between the client and server for a while to reduce the overhead of establishing a new connection with each request. However, when I ...

Error connecting to unix:///var/run/docker.sock from PHP due to permission denial

Currently, I am utilizing Docker Windows Toolbox. The docker container was set up using PHP-FPM: docker run -d -v /var/run/docker.sock:/var/run/docker.sock php:7.0-fpm-alpine When I directly use curl from the container shell: curl --unix-socket /var/ru ...

Are you using HTML5 websockets or activating flash sockets upon loading?

Hello everyone, I'm curious about how to configure my php (or python) socket server to activate when a client requests a specific file and then deactivate once the client disconnects. Additionally, is there a method to have a php or python socket server ...

Developing a Node.js system for mapping ids to sockets and back again

Managing multiple socket connections in my application is proving to be a challenge. The app functions as an HTTP server that receives posts and forwards them to a socket. When clients establish a socket connection, they send a connect message with an ID: ...

Troubleshooting SocketIO connection problems and optimizing performance through clustering

I am facing an issue with my NodeJS app that I am trying to deploy on Heroku. Here is a snippet from the index.js file: Server (port 3030) const http = require('http'); const os = require('os'); const express = require('express') const throng = require(' ...

Issue with AWS API Gateway and Restful API: socket.io encounters an error stating that the route '/socket.io?EIO=4&t=xxx&transport=polling' does not exist

My backend API services are hosted on AWS using API Gateway and EC2 instance. The backend is built with Node.js/Express JS, and socket.io is used for real-time messaging. const initializeExpress = (): void => { const app = express(); let http = re ...

Dual Networked Socket.IO Connection

I have set up a node.js server with an angular.js frontent and I am facing a problem with Socket.IO connections. The issue arises when double Socket.IO connections open, causing my page to hang. var self = this; self.app = express(); self.http = http.Ser ...

Synchronizing client information in real-time: tips, tricks, and expert advice

Currently, I am developing a PHP backend and utilizing JS/Jquery for the front end of an application that aims to facilitate near real-time communication among users. My main concern right now is determining the most effective approach to achieve this goal ...

Tips for running a Node, Express, CSS3, HTML5, MongoDB, Socket.io application on Cordova

I have a node project where I used: Express, MongoDB, Javascript, CSS3, HTML5 and Socket.io. Running the server in localhost is not an issue for me. the architecture of my application is as follows: |-- \app |-- \api-- MongodbFiles.js (schemas) ...

Struggling to find the right strategy for obtaining real-time data while implementing customized filters

After spending a week scratching my head and experimenting with different approaches, I'm hoping to find some help here... I am working on an application that needs to provide real-time data to the client. I initially considered using Server-Sent-Eve ...

"An unanticipated stream issue occurred within the pipeline" by Node.js

My application consists of Node.js, Express, and various middleware such as connect-assets and express.static. Everything is currently running on my local machine (OSX, using Node 0.8) in development mode (hence the use of express.static). An important d ...

Link Android with Python

I am working on an Android application that captures images and also have Python code for extracting image features. I am looking to connect these two components so that the Python code can receive images from the Android application. I have heard about bu ...

Python TCP server experiences issues when running over the internet

I stumbled upon this tutorial to learn more about TCP and networking. I successfully tested the code on localhost, but encountered an issue when trying it with my real IP address. My friend attempted to run the client on his system, but we kept getting the ...

Deciphering JSON information from a website using C++

Seeking assistance on extracting data from a MYSQL database connected to a webpage, where relevant information is transmitted through JSON using PHP and displayed on a separate page. My goal is to retrieve this data using C++ and sockets while verifying th ...

PyCharm 2022 is facing difficulties in establishing a connection with the Docker service, as it seems unable to locate

I recently upgraded to PyCharm 2022 and I'm having trouble configuring a Docker Python interpreter. Despite the fact that the remote Docker service is up and running (and I have a pro license), PyCharm seems unable to locate it: Loaded: loaded (/lib/syste ...

TCP allows files to be transferred without needing to close the socket

I developed a basic TCP server - client file sharing system, but I've encountered an issue where it only works when the socket is closed in the client script. I attempted to eliminate the 's.close' command from the client python script, which resulted in ...

Exploring the Distinctions: Comparing Socket and Web Server with

This code snippet demonstrates a socket-based example, sourced from the Node.js website. const socketServer = net.createServer((socket) => { socket.end('goodbye '); }).on('error', (err) => { // Error handling goes here throw err; }); // Obta ...

"Double socket event triggers within a short period of time

I'm currently developing a multiroom chat system using nodejs and socket.io. Below is the server-side script: socket.on('sendchat', function (data) { socket.username = data.name; // store the room name in the socket session for this client s ...

Create a separate socket io connection for each individual user

I have integrated socket io into my MERN stack application to facilitate communication between the client and server. Essentially, I am monitoring changes in my mongodb cluster and sending those updates to the client using the socketio emit function. Howev ...