News Articles sockets

Socket.io-Client: React+TypeScript: Socket.io-client not listening from the server

I have a server code which looks as follows: import express, { Response } from "express"; import { Server, Socket } from "socket.io"; import { createServer, Server as S } from "http"; // import router from "./routes"; // —- const app: express.Application = express(); // app.use(router); app.get("/", (_req: any, res: Response) => res.status(200).sendFile(__dirname + "/index.html") […]

What does response 101 mean in the context of socket.io?

I’m having an issue in my app where I should be getting response code 200 (and I do for the most part), but at certain points I’m getting response code 101. What exactly does this mean in the context of socket.io? I read that it means there is a switching of protocol, which is probably […]

Trigger callback as soon as socket has resolved lookup

I’m trying to run some code which creates tracing spans for the various phases in the lifecycle of an http request (socket, dns lookup, connect or secureConnect, ttfb, end). As of now it looks more or less like this: function tracedRequest( options: HttpRequestOptions | HttpsRequestOptions, callback: ResponseCallback ): ClientRequest { const isHttps = options.protocol === […]

How to listen specific fields in mongodb database by changestream?

I have a collection on my mongodb database name users and every user contains a field name posts . I want to get realtime changes data of that posts field when a user add a new post or update existing post and take the updated value from socket server and send it back to frontend. […]

How does discord.com deliver message?

I’m just so much curious about knowing how has discord chat architecture been designed? I just went to the network tab to inspect requests (assuming it to be web sockets or web rtc) and only saw queries for fetching the messages to be displayed and a post request when I send a message. There was […]

Where to instantiate a socket so that it is available before the Nuxt app loads?

I am looking for somewhere in a Nuxt app to instantiate a nuxt-socket-io socket so that it’s persistent and globally available (it’s mostly used in vuex). Currently I’m doing this in the mounted() section of the main page: <script> export default { mounted () { this.$root.mainSocket = this.$nuxtSocket({ name: ‘main’, persist: ‘mainSocket’, reconnection: false }); […]

Access all data inside from a node.js HTTPS server

Desired goal: To intercept all TCP packets (including the clienthello and other http/s packets) from node.js Issues: When attaching a "data" event, it appears to be overridden. Resources: I have been reading the code provided from https://github.com/nodejs/node/blob/master/lib/_tls_wrap.js however, I cannot make sense of how to achieve my goal. The question: What must I do inorder […]

How to write a tcp message following specific protocol in Nodejs with net module

So lets say I have this message format that I have to send to the server: I am able to connect to the server and write to it like so: client.write(‘MESSAGEn8n0ncontent’); But I get this in response: "Error: Message length exceeds max of 104857600" What am I missing here? Source: JavaSript – Stack Overflow

vue advanced chat with PHP(laravel)

i have tried using vue advanced chat with php (laravel), but i cannot display the messages. Can I have an example of use with PHP. thanks in advance Source: Vue – Stack Overflow

SO_REUSEADDR in NodeJs using net package

I have two backends. Backend A and Backend B. Backend B sends and receives info using a socket server running at port 4243. Then, with Backend A, I need to catch that info and save it. But I have to also have a socket server on Backend A running at port 4243. The problem is […]

How to listen close event in pusher js

We are trying to trigger events based on channel outputs created in pusher import Pusher from "pusher-js"; import { logoutUser } from "../redux/actions/authActions"; import store from "../redux/store/store"; const authSessionPusher = (sessionId) => { const pusher = new Pusher("xxxxxxxxxxxxxxxx", { cluster: "ap2", encrypted: true }); const channel = pusher.subscribe(sessionId); console.log(channel); channel.bind("authSession", (data) => { if (data.message […]

Pass Response to React Component with Socket

I am currently developing a component in ReactJS that should be able to display some data coming from a call to a server but unable to get the data to display dynamically in the child component import React, { useState, useEffect } from "react"; import socketIOClient from "socket.io-client"; import Main from "./Main"; import Response from […]

Pass Response to React Component with Socket

I am currently developing a component in ReactJS that should be able to display some data coming from a call to a server but unable to get the data to display dynamically in the child component import React, { useState, useEffect } from "react"; import socketIOClient from "socket.io-client"; import Main from "./Main"; import Response from […]

Pass Response to React Component with Socket

I am currently developing a component in ReactJS that should be able to display some data coming from a call to a server but unable to get the data to display dynamically in the child component import React, { useState, useEffect } from "react"; import socketIOClient from "socket.io-client"; import Main from "./Main"; import Response from […]

Pass Response to React Component with Socket

I am currently developing a component in ReactJS that should be able to display some data coming from a call to a server but unable to get the data to display dynamically in the child component import React, { useState, useEffect } from "react"; import socketIOClient from "socket.io-client"; import Main from "./Main"; import Response from […]

A socket event is getting transmitted but not being received on the other side

In our application we have two ends, agent-end and client-end. The agent-end gets a static js file from server, the static js file has a bunch of socket events. When a button is clicked on the agent-end it emits the following event. socket.emit(‘clientLeaveChannel’, { channelId : channelIds }); socket.disconnect(); tree.disconnect(); The emitted event is appearing […]

A socket event is getting transmitted but not being received on the other side

In our application we have two ends, agent-end and client-end. The agent-end gets a static js file from server, the static js file has a bunch of socket events. When a button is clicked on the agent-end it emits the following event. socket.emit(‘clientLeaveChannel’, { channelId : channelIds }); socket.disconnect(); tree.disconnect(); The emitted event is appearing […]

React native, socket io data response not working in ios

I am currently working on a mobile app for a client, based on their survey website. The authentication process (Facebook/twitter) is required from a third-party service (web link) for which in the app I carry out the authentication process through a webview (Facebook/twitter). The service/backend and client/mobile app communicate through Socket.io, before performing the authentication […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.