Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ccbluex/axochat-client

JavaScript API client for AxoChat
https://github.com/ccbluex/axochat-client

Last synced: about 11 hours ago
JSON representation

JavaScript API client for AxoChat

Awesome Lists containing this project

README

        

# AxoChat Client

NPM Package: https://www.npmjs.com/package/@ccbluex/axochat-client

## Example Usage

> The LiquidBounce chat's certificate is self-signed, so you need to disable the certificate verification.

```typescript
import { Client } from '@ccbluex/axochat-client';

const client = new Client();

client.connect('wss://chat.liquidbounce.net:7886/ws');

client.on('open', () => {
console.log('Connected!');

client.loginJWT('TOKEN', true);

client.on('success', ({ reason }) => {
if (reason === 'Login') {
client.on('message', (data) => {
console.log(`${data.author.name}: ${data.content}`);
});

client.on('privateMessage', (data) => {
console.log(`[PRIVATE] ${data.author.name}: ${data.content}`);
});

client.sendMessage('Hello, World!');
}
});

client.on('error', ({ message }) => {
console.log(`[ERROR] ${message}`);
});
});
```