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.
Related
I having some doubts that:-
what is need to use the socket.io client we can use only the socket.io server to stop refreshing the app.
what is different between the socket.io client and socket.io server.
check this link
socket-io.client is the code for the client-side implementation of socket.io. That code may be used either by a browser client or by a server process that is initiating a socket.io connection to some other server (thus playing the client-side role in a socket.io connection).
A server that is not initiating socket.io connections to other servers would not use this code. This has been made a little more confusing that it probably should be because when using socket.io, it appears that both client and server are using the same socket.io.js file (because they both refer to a file with the same name), but is not actually the case. The server is using a different file than the client.
From the Github page for socket-io.client:
A standalone build of socket.io-client is exposed automatically by the socket.io server as /socket.io/socket.io.js. Alternatively you can serve the file socket.io.js found at the root of this repository.
Keep in mind that there are unique features that belong to client and server so it should not be a surprise that they use some different code. Though they share code for parsing the protocol and things like that, the server has the ability to run a server or hook into an existing web server and it has methods like .join() and .leave() and data structures that keep track of all the connected sockets and is expected to live in the node.js environment. The client has the ability to initiate a connection (send the right http request), do polling if webSockets are not supported, build on a native webSocket implementation if present, etc....
I created a small server using socket.io and node js and deployed in heroku earlier. I was easily able to have client connected to server with wss/ws protocol but when I deployed my app too AWS, Clients are not connecting. I debugged the application in client side but Its just not connecting to server. Did I miss something? are there extra steps needs to followed to make it work?
Thanks.
Answering my own question, I had to add .ebextensions folder with a config in my project root directory. You can look at the following tutorial to make it work https://nikhilmopidevi.github.io/2017/10/18/WebSockets-with-AWS-Elastic-Beanstalk/
I try to make a client-server app with socket.io.
Socket.io server seems work but the client cannot connect to it. The error i get is about the '/socket.io/socket.io.js' like what it is unable to load it.
So here are my questions
is it mandatory to have server and client in the same folder as we can see in the official demo ?
can we make a nodejs socket.io server without express ?
Depending on how your project is setup, you need to create 2 server files, 1 for the app, and one for the websockets, and every time a user opens the app it should open(and be told where to try and open the connection) a connection to the websockets server. On my websockets apps I have the app running on localhost:3000, and websockets server on localhost:3001 (and tell the app to look for a server on 3001), so really you don't need to have the server files in the same folder, they can be in 2 opposite ends of your computer, as long as the app points to the server, then your fine, once a connection has been opened, the websocket server will see the client, and it should work! Let me know if that make sense.
No, you can download socket.io front-end lib from another sources, for example cdn. Be sure you installed the right version.
Yes, you can make it without express. Express is just another option for creating an socket.io server.
For example, currently in my project that is written in another back-end node framework i'm using the code below to establish the socket.io server.
const io = require("socket.io")(2337);
io.on("connection", socket =>
// some code
)
I fixed the problem of websocket communication between my server and my client.
After inspected my html client file, i saw on the console this error message 'ReferenceError: io is not defined'.
I google that error and i found this.
I am simply a beginner at NodeJs. I have a client's Ionic project.
He has sent me
Server Access FTP:
IP, user and pass
and has said, if any server side changes then to be done on server.
app.js file for socket and server side component is in /usr/www
Now i can't find any 'app.js' consisting of node commands in the project. There is an app.js in www/ directory but there is not node command inside. How to access server and where to use the IP, user, pass.
Please explain if you know the answer. Considering me totally nil at node.js and express.js
You can use node-ftp as a FTP client. It is a module for node.js which will provide an interface to communicate with the FTP server. You can refer this link to get more information about node-ftp.
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.