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 🙏

© 2026 – Pkg Stats / Ryan Hefner

nahtuh-client

v1.0.12

Published

This is a Readme file.

Downloads

6

Readme

Nahtuh Client

Nahtuh client is a javascript library to use nahtuh API to develop real time collaboration application.

Contents

Getting Started

CDN

<!-- index.html -->
<script src="https://cdn.nahtuh.com/libraries/nahtuhclient.js"></script>
<script>
  const { nahtuhClient, identityManager } = window.NahtuhClient;
</script>

NPM

npm i nahtuh-client
import { nahtuhClient, identityManager } from 'nahtuh-client';

API Documentation

Connection API

Start Connection

Start websocket connection

// use this only when autoStart is set to false
let response = await nahtuhClient.start();

Stop Connection

Stop websocket connection

// use this only when autoStart is set to false
let response = await nahtuhClient.stop();

Event Management API

Create Event

let response = await nahtuhClient.createEvent(participantName, autoStart);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |participantName|No|String|nickname you want to use in the event |autoStart|Yes|Boolean|Auto Connect web socket when value is true

Response

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |eventInfo|EventInfo| |participant|Participant| |participantToken|ParticipantToken|

Join Event

let response = await nahtuhClient.join(eventId, participantName, autoStart);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |eventId|No|String|Unique Id of the event you want to join to |participantName|No|String|nickname you want to use in the event |autoStart|Yes|Boolean|Auto Connect web socket when value is true

Response

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |eventInfo|EventInfo| |participant|Participant| |participantToken|ParticipantToken|

Leave Event

let response = await nahtuhClient.leaveEvent(autoStop);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |autoStop|Yes|Boolean|Auto Disconnect web socket when value is true

Get Participant List

Get all participants in the current event

let response = await nahtuhClient.getParticipantList();
Response

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | ||List|

Get Current Participant

Get current participant info

let response = await nahtuhClient.getCurrentParticipant();
Response

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | ||Participant|

Group Management API

Join Group

Create or join existing group

let response = await nahtuhClient.joinGroup(participantId, groupName);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |participantId|No|String| |groupName|No|String|

Leave Group

let response = await nahtuhClient.leaveGroup(participantId, groupName);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |participantId|No|String| |groupName|No|String|

Get Group Member

Get all group members

let response = await nahtuhClient.getGroupMember(groupName);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |groupName|No|String|

Response

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | ||List|

Host Configuration API

Host configuration is a configuration only the event's host can access. It can be useful to implement host rejoin functionality.

Set Host Configuration

await nahtuhClient.setHostConfiguration(config);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |config|No|object|any configuration you want to save

Get Host Configuration

var response = await nahtuhClient.getHostConfiguration();
Response

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | ||object|configuration saved by the host

Messaging API

Broadcast

Send message to all event participants

let response = await nahtuhClient.broadcast(message);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |message|No|String|

Send To User

Send message to a specific user

let response = await nahtuhClient.sendToUser(participantId, message);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |participantId|No|String| |message|No|String|

Send To Group

Send message to all participant in a specific group

let response = await nahtuhClient.sendToGroup(groupName, message);
Parameters

| Name | Nullable | Type | Description | | ------------------------------- | -------- | -------- | ------------------------------------------------------------ | |groupName|No|String| |message|No|String|

Event Handlers

On Participant Joined

Call back function when new participant join to an event

nahtuhClient.onParticipantJoined = (data) => {}
Data

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | ||Participant|

On Participant Leave

call back function when new participant leave an event

nahtuhClient.onParticipantLeave = (data) => {}
Data

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | ||Participant|

On Incoming Message

call back function when new message received

nahtuhClient.onIncomingMessage = (data) => {}
Data

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | ||Message|

On Group Member Joined

call back function when participant join to a group

nahtuhClient.onGroupMemberJoined = (data) => {}
Data

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |groupName|String| |participantId|String| |participantName|String|

On Group Member Left

call back function when participant left a group

nahtuhClient.onGroupMemberLeft = (data) => {}
Data

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |groupName|String| |participantId|String| |participantName|String|

Types

EventInfo

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |activityId|String|Unique Id used by the activity created an activity is submitted to nahtuh |activitySetId|String| |createdDate|String|Timestamp of the event creation |eventId|String|Unique Id for the newly created event |invitationUrl|String|

Participant

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |avatarUrl|String| |connected|Boolean|connection status of the websocket |isHost|Boolean| |participantId|String| |participantName|String|

ParticipantToken

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |username|String| |accessToken|String|Token used to access nahtuh API |refreshToken|String|Token used to refresh accessToken

GroupMember

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |participantId|String| |participantName|String|

Message

| Name | Type | Description | | ------------------------------- | -------- | ------------------------------------------------------------ | |method|String|BM = Broadcast Message, PM=Private Message, GM = Group Message |content|String| |senderId|String|ParticipantId of the sender