1.0.4 • Published 3 years ago

pika-pichu v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Pika-Pichu

Pika-Pichu is a simple wrapper around the W3CWebSocket API which allows you to easily connect to the pikachu WebSocket server.

Installation

Via npm:

npm install pika-pichu

Via Yarn:

yarn add pika-pichu

Usage

Instantiate a new Pichu class

import { Pichu } from 'pika-pichu';

const url = 'ws://localhost:8080';
const token = 'my-token';
const pikaPichu = new PikaPichu(url, token);
// client connects to the server automatically when it is constructed 

Send a message to the server

pikaPichu.sendJSON({
	  type: 'message',
  data: 'Hello world!'
});

Receive a message from the server

pikaPichu.GetJSONMessageon((data) => {
  console.log(data);
});
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago