This package provides a simple real-time chat server using Socket.io for communication and the data-decr-encr
npm package for message encryption and decryption.
You can install this package via npm:
npm install rt-chat
const server = require('rt-chat');
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});
- Real-time communication using Socket.io.
- Encryption and decryption of messages for secure communication.
-
join(username): Broadcasted when a new user joins the chat.
username
is the username of the new user. -
message(encryptedMessage): Broadcasted when a user sends a message.
encryptedMessage
is the encrypted message sent by the user. -
userLeft(username): Broadcasted when a user disconnects from the chat.
username
is the username of the disconnected user.
- listen(port[, callback]): Starts the chat server on the specified port. Optionally, you can provide a callback function to be called when the server starts.
Contributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any problems or have suggestions for improvements.
This package is licensed under the MIT License. See the LICENSE file for details.