simple-websocket-chat-client

2.0.1 • Public • Published

simple-websocket-chat-client

A simple WebSocket chat client for Node.js.

Installation

You can install this package via npm:

npm install simple-websocket-chat-client

Usage

const SimpleWebSocketChatClient = require('simple-websocket-chat-client');

// Create a new instance of the chat client
const chatClient = new SimpleWebSocketChatClient('ws://chat.example.com');

// Sending a message
chatClient.sendMessage('Hello, world!');

API

new SimpleWebSocketChatClient(serverAddress)

Creates a new instance of the WebSocket chat client.

  • serverAddress (optional): The address of the WebSocket server to connect to. Defaults to 'ws://localhost:8080'.

sendMessage(text)

Sends a message to the chat server.

  • text: The text of the message to send.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies (3)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i simple-websocket-chat-client

    Weekly Downloads

    1

    Version

    2.0.1

    License

    ISC

    Unpacked Size

    3.41 kB

    Total Files

    5

    Last publish

    Collaborators

    • xiadelilah