npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minarai-client-sdk-js-websocket

v0.0.14

Published

Minarai Client SDK for Websocket

Downloads

13

Readme

minarai client SDK (for JavaScript/WebSocket)

Description

A SDK that enables you to connect minarai easily on Node.js, browser both.

Requirement

Install

on your project root npm install -S Nextremer/minarai-client-sdk-js-websocket or yarn add https://github.com/Nextremer/minarai-client-sdk-js-websocket.git

Usage

import MinaraiClient from 'minarai-client-sdk-js-websocket';

const minaraiClient = new MinaraiClient({
  ws: WebSocket,
  lang: 'ja-JP',
  websocketRootURL: 'ws://localhost:3000/ws', /* minarai WebSocket Connector URL */
  websocketOptions: [], /* options for WebSocket https://developer.mozilla.org/ja/docs/Web/API/WebSocket */
  applicationId: this.state.connectionInfo.applicationId, /* application's id you want to connect */
  clientId: this.state.connectionInfo.clientId,
  userId: this.state.connectionInfo.userId,
  deviceId: this.state.connectionInfo.deviceId,
});

minaraiClient.init();

// binding events
minaraiClient.on('connect', function(){
  console.log("## websocket connected. trying to join as minarai client");
});
minaraiClient.on('joined', function(){
  console.log("## minarai CONNECTED");
});
minaraiClient.on( "message", function( data ){
  console.log("recieve message");
  console.log(data)
});
minaraiClient.on( "error", function( err ){
  console.log("minarai client error");
  console.log(err);
});

// send message "hello" to dialogue-hub every 3 seconds
setInterval( function(){
  minaraiClient.send("hello");
}, 3000 );

references

constructor options

  • ws: WebSocket Object
  • lang: language option( default: "ja-JP" )
  • websocketRootURL: root url of minarai WebSocket Connector
  • websocketOptions: options for io.connect method (ex) {}
  • applicationId: application id to connect
  • clientId: clientId
  • userId: userId
  • deviceId: deviceId
  • debug : set true to show debug logs
  • slient : set true value to hide all the logs

methods

  • send: send message to minarai
    • arguments
      • uttr: string: message to send
      • options :
        • lang: string: language option. ex: 'ja-JP'
        • extra: any: you can pass extra info to minarai.
  • sendSystemCommand: send system command to minarai
    • arguments
      • command: string
      • payload: any
cli.send('hello', { lang: 'ja-JP', extra: {} });
cli.sendSystemCommand('happyEmotionDetected', { value: true });

events

  • connect: when connected to minarai successfully
  • joined: when signed in to minarai as client successfully
  • disconnected: when disconnected to minarai successfully
  • sync: when you or your group send message to minarai(for sync message between multiple devices)
  • sync-system-command: when you or your group send system command to minarai(for sync system command between multiple devices)
  • message: when minarai send any event