Connecting Client and Server with Nodejs - node.js

What is the proper way to connect using Node v7.4.0, from the Client to the Server?
More specifically, how would this be done using React, Express, and Socket.io?

Related

Laravel Socket Subscribe

I have created a socket server in Node js. It is working fine while subscribing from an ejs file.
The part I'm confused is how do I keep my laravel application listening to the server I have created?
Thanks in advance.
Laravel community already come up with a solution and it's call Laravel Echo Server (Check that out) that basically just a Node + socket.io that implement all the pub/sub logic for your Laravel app.
If you want to take complexity into your own hand then you could try setting up broadcasting driver in Laravel to use Redis. In simple term, Redis is the middleman that connect your Laravel app to your socket.io app for websocket connection. This is call message broker.
For example, you have Laravel app listening and publishing event on a Redis server and Node + Socket.io server doing the same thing. When you fire an event through Laravel, your node will able to listen to that event too through Redis acting as a broker. Your node then can instruct Socket.io to do whatever it want with its front-end user.
This solution doesn't require Laravel-echo but you need to do a lot of stuff for authentication, handling private channel and presence channel .. etc.
I suggest you take a look into Laravel Echo Server as what I've describe is only scratching the surface.

Socket.io-client cannot connect to server using websocket transport

I'm developing a socket.io Server in Node.js. To test it, I am developing a set of integration tests using Jest. Each test establishes a connection to my local Socket.io Server, however, I am unable to require that the transport is 'websocket'.
I know that my Socket.io Server supports the websocket transport, as it I demonstrate when the browser connects to it.
Is there anything different about running the socket.io Client in Node.js that prevents the 'websocket' transport from being used?

Connect to Socket.io server with standard web-socket client

Is it possible connect to socket.io server with standard web-socket client?
When connecting to socket.io server through socket.io client, Url started with HTTP but for web-socket clients must use ws.
so, if it is possible, how to connect to socket.io server and what is the url for connecting to socket.io server?
socket.io has a protocol on top of webSockets. If you're going to use socket.io on the server side, then you have to use a socket.io-compatible client on the other end.
So, you can't use a plain webSocket client to connect to a socket.io server.
The socket.io protocol is here.

Need help http Server and client server

I have used an application for login, adding friends and chat using node.js and mongoDB.I installed the node.js and monogoDB on ec2 instance. However, I do not know if need to use client server and http server?
Here is the application that I used https://github.com/1karthik/Node.js_UserLogin_Template
note: I am new to node.js and mongoDB
you dont need a "client server". Your http server will serve to your clients some javascript files that will help them to comunicate with your server. If you go in app/public/scripts you can see theese files.

web server(tomcat, jboss..etc) can communicate with nodejs?

our team use both web server(tomcat or jboss) and node js
my team member make user management in web server. and
and he will send user session to node js socket.
is it possible? for node js how to receive web socket connection from web server?
I use express, socket io,webrtc.io module in nodejs
Yes web servers can communicate to the node js using curl, which hits url and process the response.

Resources