pika-pichu
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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);
});

Readme

Keywords

Package Sidebar

Install

npm i pika-pichu

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

9.64 kB

Total Files

14

Last publish

Collaborators

  • karim-w