1.0.3 • Published 6 months ago

panda-client v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Panda Client

Also see the server side package written in go.

Installation

npm install panda-client

How to use?

First you need to initialize the package by calling Panda and then call init:

import { panda } from 'panda-client';

const socket = panda('ws://your-path');
socket.init();

Main functionalities

subscribe:

By this method, you can subscribe to a channel and listen for new messages which will be published.

First parameter is the channel name that you want to subscribe to and the second parameter is a callback which will process each new message:

socket.subscribe('channel_name', (message: string) => {
  // do something with the received message.
});

unsubscribe:

As you can understand by the name of this method, it will unsubscribe from a channel.

It only accepts one parameter and it's the channel name:

socket.unsubscribe('channel_name');

send:

Use send in order to send messages directly to the server (no channel name is needed).

This method has only one parameter and that's the message itself:

socket.send('your message');

publish:

You can use this method to publish messages over a specified channel.

It has two parameters. First one is the channel name and second one is the message itself:

socket.publish('channel_name', 'message');

License

Licensed under the MIT License.

1.0.3

6 months ago

0.5.13

3 years ago

0.5.12

3 years ago

0.5.10

3 years ago

0.5.11

3 years ago

0.5.8

3 years ago

0.5.9

3 years ago

0.5.7

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.4.9

3 years ago

0.4.8

3 years ago

0.4.10

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.3.9

3 years ago

0.4.5

3 years ago

0.3.6

3 years ago

0.4.4

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.1

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago