mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Add Server constructor options define. * Add detailed event callback define. * Add more test.
19 lines
449 B
TypeScript
19 lines
449 B
TypeScript
import { Server, Client, Packet, ServerOptions } from 'mosca';
|
|
|
|
const settings: ServerOptions = {
|
|
port: 1883,
|
|
host: '0.0.0.0'
|
|
};
|
|
|
|
const server = new Server(settings);
|
|
|
|
server.on('ready', () => {});
|
|
|
|
server.on('clientConnected', (client: Client) => {});
|
|
|
|
server.on('clientDisconnected', (client: Client) => {});
|
|
|
|
server.on('published', (packet: Packet, client: Client) => {});
|
|
|
|
server.on('subscribed', (topic: string, client: Client) => {});
|