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

shift-chat-mobile-client

v0.1.4

Published

Mobile client for Shift Chat

Downloads

637

Readme

shift-chat-mobile-client

A TypeScript client for integrating mobile applications with the Shift Chat Server. Supports both WebSocket (Socket.IO) for real-time events and HTTP for RESTful operations.

Features

  • Real-time Messaging: Send and receive messages instantly via WebSocket.
  • Cross-Platform: Works on React Native (Expo), Web, and Node.js.
  • Authentication: JWT-based authentication (Bearer token).
  • Workspace & Channel Discovery: Fetch workspaces and channels available to the user.
  • Message Actions: Reply, Edit, Delete, and React to messages.

Installation

npm install shift-chat-mobile-client
# or
yarn add shift-chat-mobile-client

Note: Access token generation should be handled by your backend integration using the python shift-chat-server-client.

Usage

Initialization

import { ShiftChatMobileClient, ShiftChatEvent } from 'shift-chat-mobile-client';

const client = new ShiftChatMobileClient({
  token: "YOUR_JWT_ACCESS_TOKEN"
});

Connection

// Connect to the WebSocket server
client.connect();

// Listen for connection events
client.on(ShiftChatEvent.Connect, () => {
  console.log('Connected!');
});

client.on(ShiftChatEvent.ConnectError, (err) => {
  console.error('Connection failed:', err);
});

Discovery

Before sending messages, you usually need to know which channel to send to.

// 1. Get user's workspaces
const workspaces = await client.getWorkspaces();
const myWorkspace = workspaces[0];

// 2. Get channels in that workspace
const channels = await client.getChannels(myWorkspace.id);
const generalChannel = channels.find(c => c.name === 'General');

Sending Messages

// Send a simple text message
const message = await client.sendMessage({
  channelId: generalChannel.id,
  content: "Hello everyone!",
  // lexicalJson is optional; a basic paragraph node will be generated if omitted
});

// Reply to a message (Thread)
await client.replyToMessage(message.id, {
  channelId: generalChannel.id,
  content: "This is a reply in a thread"
});

Message Actions

// Edit a message
await client.updateMessage({
  messageId: message.id,
  content: "Hello everyone! (edited)",
  lexicalJson: "..." // Provide updated Lexical JSON string
});

// React to a message (Toggle)
await client.toggleReaction({
  messageId: message.id,
  emoji: "👍"
});

// Delete a message
await client.deleteMessage(message.id);

Listening for Events

// Receive new messages in real-time
client.on(ShiftChatEvent.NewMessage, (msg) => {
  console.log(`[${msg.channelId}] ${msg.user?.firstName}: ${msg.content}`);
});

// Receive replies
client.on(ShiftChatEvent.NewReply, (payload) => {
  console.log(`New reply to ${payload.rootMessageId}:`, payload.reply.content);
});

// Receive reactions
client.on(ShiftChatEvent.ReactionUpdated, (payload) => {
  console.log(`Reactions updated for message ${payload.messageId}:`, payload.reactions);
});

API Reference

ShiftChatMobileClient

Connection & Events

| Method | Description | | :--- | :--- | | connect() | Establishes WebSocket connection with auth headers. | | disconnect() | Closes the connection. | | isConnected() | Returns boolean indicating socket connection status. | | on(event, handler) | Subscribes to a specific event. | | off(event, handler) | Unsubscribes from a specific event. | | emit(event, data) | Emits a raw event to the server. |

Workspaces

| Method | Description | | :--- | :--- | | getWorkspaces() | Get workspaces for the user. Returns Promise<Workspace[]> | | getWorkspace(id) | Get a specific workspace. Returns Promise<Workspace> | | getWorkspaceUsers(id) | Get members of a workspace. Returns Promise<WorkspaceMember[]> |

Channels

| Method | Description | | :--- | :--- | | getChannels(workspaceId?) | Get channels for a user/workspace. Returns Promise<Channel[]> | | getChannelById(id) | Get a specific channel. Returns Promise<Channel> | | createGroupChannel(payload) | Creates a group channel. Returns Promise<Channel> | | createPrivateChannel(payload) | Creates a private channel (DM). Returns Promise<Channel> |

Messages

| Method | Description | | :--- | :--- | | getMessages(options) | Fetch messages for a channel. Returns Promise<Message[]> | | getThread(messageId) | Fetch full thread for a message. Returns Promise<Message[]> | | sendMessage(payload) | Sends a message. Returns Promise<Message> | | replyToMessage(rootId, payload) | Sends a thread reply. Returns Promise<Message> | | updateMessage(payload) | Edits a message. Returns Promise<Message> | | toggleReaction(payload) | Toggles emoji reaction. Returns Promise<{ success: boolean; added: boolean }> | | deleteMessage(id) | Deletes a message. Returns Promise<void> |

Events (ShiftChatEvent)

  • Connect: Socket connected
  • Disconnect: Socket disconnected
  • NewMessage: A new message was posted in a subscribed channel
  • NewReply: A reply was posted to a thread
  • MessageUpdated: A message content was edited
  • ReactionUpdated: Reactions on a message changed
  • NewNotification: User was mentioned or notified