Kind of good and bad... good: it’s a wonderful chat app. Bad: it is connected through all repls? I followed all the steps above, and sent some messages, at the same time opened up another tab with your repl and yeah saw the messages i sent...
Is there any way to make it more private(like only people with my repl project link can see the messages)?
@nngggaming I have used Socket.IO which it let's you to connect users to other users. It is not a database, messages aren't saved in the database, only if someone joined the repl (if one of your family or friends or people on repl.it) can see messages on this web.
Hi, this is a tutorial about how to build a chat app
here is it @Leroy01010
Let's start
1. Libraries
We need
socket.io
to make a connection from user to a user.And we need an express server, and also http.
Code:
2. Socket.io connection
We need some lines of code, to make a websocket connection.
The first block of code is for the username (for the chat app) and then to send: 'Username joined the chat...'
The second block of code is the opposite of the first one.
The third block of code is about the message, when the user sends a message, it will send his message with the username and the date of the message.
The fourth code block (outside of the websocket connection) is the port listen handler.
Code:
4. Render the HTML file for the chat.
We need to add some lines before the socket connection.
To render the HTML chat app file.
Code:
5. Fill the index.html with code to make a chat app.
We need to use jQuery to make a form for the chat.
Code:
So we basically added some CSS and some javascript (jQuery) to:
And that's it
Have a great day!
Source code: https://repl.it/@ZDev1/chatorzo-2
Kind of good and bad... good: it’s a wonderful chat app. Bad: it is connected through all repls? I followed all the steps above, and sent some messages, at the same time opened up another tab with your repl and yeah saw the messages i sent...
Is there any way to make it more private(like only people with my repl project link can see the messages)?
@nngggaming I have used Socket.IO
which it let's you to connect users to other users.
It is not a database, messages aren't saved in the database, only if someone joined the repl (if one of your family or friends or people on repl.it) can see messages on this web.