/chatservice

Primary LanguageJavaScript

Chatbox

Chat using websocket native from NodeJS, actually implementing websocket to NodeJS using native . by romariobs

How to start the application?

The Solution

In this code we have a server with the capacity to send and receive messages through websockets. Over here you will encounter the following type messages:

  • MSG_TO: When you send a message to someone in a channel: {'type': 'MSG_TO', 'message': '', 'from': 'USER', 'to': 'SOMEONE'}
  • MSG_ALL: You will send a message to everyone in the channel: {'type': 'MSG_ALL', 'message': '', 'from': 'USER', 'to': ''}
  • MSG_PM_TO: You will send a privately message to a user: {'type': 'MSG_PM_TO', 'message': '', 'from': 'USER', 'to': 'SOMEONE'}
  • USER_CREATE: Try to join a new user to the channel: {'type': 'USER_CREATE', 'user': 'newUser'}
  • USER_EXIT: User opt to exit from chat. {'type': 'USER_EXIT'}