All Projects → cliffhall → react-chat-client

cliffhall / react-chat-client

Licence: MIT license
A simple chat client built in React for communicating with the node-multi-server-chat example

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to react-chat-client

Darkwire.io
End-to-end encrypted instant web chat
Stars: ✭ 594 (+2375%)
Mutual labels:  socket-io, chat-application
Chattt
❯❯❯ Chat without leaving your terminal
Stars: ✭ 239 (+895.83%)
Mutual labels:  socket-io, chat-application
Nodejs Socketio Chat App
MEAN Stack & Socket.IO Real-time Chat App | A MEAN stack based Real Time chat application
Stars: ✭ 45 (+87.5%)
Mutual labels:  socket-io, chat-application
v chat sdk
official sdk for v chat this is a complete chat ecosystem use flutter for clint node js and socket io for server side flutter chat v chat sdk and flutter group chat
Stars: ✭ 25 (+4.17%)
Mutual labels:  socket-io, chat-application
darkwire-server
Encrypted web socket chat - Darkwire.io Chat Server
Stars: ✭ 18 (-25%)
Mutual labels:  socket-io, chat-application
SocketIO Chat APP
This is the simple Chat Application in which user can join the room and continue chatting with others.
Stars: ✭ 50 (+108.33%)
Mutual labels:  socket-io, chat-application
Video Call App Nodejs
A conference call implementation using WebRTC, Socket.io and Node.js
Stars: ✭ 234 (+875%)
Mutual labels:  socket-io, chat-application
TelegramClone
JetGram is an open source desktop app Telegram clone made with JavaFx.
Stars: ✭ 50 (+108.33%)
Mutual labels:  socket-io, chat-application
node-vue-chat
🚀 🌠 Real Time Chat Application created with MEVN Stack
Stars: ✭ 89 (+270.83%)
Mutual labels:  socket-io, chat-application
react-app-simple-chat-app
A Simple Chat Application using MERN stack (MongoDB, Express JS, React JS, Node JS) and Socket.io for real time chatting
Stars: ✭ 41 (+70.83%)
Mutual labels:  socket-io, chat-application
bubbly
Full stack chat application created w/ Next.js, Socket.IO, Express, React and TypeScript
Stars: ✭ 24 (+0%)
Mutual labels:  socket-io, chat-application
darkwire-client
Encrypted web socket chat - Darkwire.io client
Stars: ✭ 23 (-4.17%)
Mutual labels:  socket-io, chat-application
Node Chat One To One
Node.js socket-io based one to one chat engine
Stars: ✭ 47 (+95.83%)
Mutual labels:  socket-io, chat-application
SocketIOSharp
C# implementation of Socket.IO protocol revision 4 client and server.
Stars: ✭ 101 (+320.83%)
Mutual labels:  socket-io, socket-io-client
socket.io-client-core
High-Performance Socket.IO client in C#
Stars: ✭ 70 (+191.67%)
Mutual labels:  socket-io, socket-io-client
socialApp-MERN
Social Networking web app similar to Instagram.
Stars: ✭ 35 (+45.83%)
Mutual labels:  socket-io, socket-io-client
uni-chat
uni-app + vue3.0 + typescript + vue-cli 仿手机QQ聊天 qq表情包
Stars: ✭ 55 (+129.17%)
Mutual labels:  socket-io
titanium-socketio
Use the native Socket.io SDK's with Axway Titanium.
Stars: ✭ 25 (+4.17%)
Mutual labels:  socket-io
TinyFlowerBeds
Educational bot that posts a tiny flower bed on Twitter every few hours. Check it out if you're new to Python and open source!
Stars: ✭ 12 (-50%)
Mutual labels:  beginner-friendly
Hacktoberfest-Nepal-2020
A beginner-friendly open source repository to create your first pull request.
Stars: ✭ 15 (-37.5%)
Mutual labels:  beginner-friendly

react-chat-client

What is this?

A React-based chat client for communicating with my node-multi-server-chat example.

This client differs from the minimalist one that comes with the server project in a few ways:

  • It lets you log in with any number of different users (instead of the predefined Anna and Billy)
  • It allows you to choose the recipient of each outgoing message from a dropdown of all connected users
  • It displays scrollable message history
  • It notifies you when your selected recipient disconnects
  • If your lost recipient reconnects, it notifies you and selects them again in the dropdown
  • It stores and displays messages by thread, so you can carry on separate conversations with different users
  • When you receive a message from another user, it automatically selects them as a recipient and shows their thread

You can read a tutorial about how it was built with only React and then refactored to use Redux.

Two users chatting

Two users chatting

Setup

Install Node and npm

Node 7.7 or above (also installs npm)

Install Node modules

cd path/to/react-chat-client (the rest of this document assumes you are at this location)

npm install

Initialize server project

For convenience, this project pulls in the node-multi-server-chat project as a Git submodule. After you run the following command, you'll find that project in the server folder, with its node-modules installed.

npm run install-server-module

Launch

Launching Socket Server Instances

Several npm scripts have been defined in package.json for launching the socket server instances.

Inside your IDE

If you're running a modern IDE like Webstorm, you can just open the npm window and double-click on each start-server-x script. A separate integrated terminal will launch and you can monitor each instance's log output.

From the command line

In each of four separate terminal windows, enter one of the following commands:

npm run start-server-1

npm run start-server-2

npm run start-server-3

npm run start-server-4

Launching the Server for the React Chat Client

The react-scripts library will compile the client bundle and start the server for the client.

npm run serve-client

Once that's done, open a couple of browser windows, navigate to http://localhost:3000/, enter two different user names, choose a server port, and connect. It doesn't matter if you're on different ports or the same port, the servers will make sure your messages make it to each other.

Note that when you connect the first user, you won't see anything other than a status message of 'Connected' and the 'Connect' button will change to 'Disconnect'. As soon as you sign in another user, you'll see a dropdown with 'Choose someone to message' in it. As users connect and disconnect, this list will be updated on all connected clients, and of course your own name won't be listed.

Implementation

This React client uses:

  • redux to manage application state
  • react-redux to inject the store's dispatch function and selected parts of the application state into any component's props.

Protocol handling

The protocol is outlined in the chat server README, so there's no need to duplicate that here. This client operates the same as the minimalist chat client in the server project, except all the protocol handling is encapsulated in the Socket class.

The socketMiddleware middleware instantiates a Socket instance, passing in callbacks for

  • onConnectionChange, called when the socket connection state changes
  • onError, called when the socket experiences an error condition, so status can be reported
  • onIncomingMessage, called when an instant message is received
  • onUpdateClient, called when the server updates the client with the list of connected users

TODO

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].