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

@evo/chat-core

v0.8.5

Published

core Besida module with base functional set for chat

Downloads

24

Readme

Evo package, that controls all data mutations that are common for chat (message send, history, read counters etc), provides simple api and bunch of utils. It based on swindonJS library, that manages WS connection. All request/response formats are handling by Besida.

Installation

npm install --save -E @evo/chat-core

Basic Usage

import { Swindon } from 'swindon';
import { 
    Besida,
    BESIDA_ROLE_COMPANY
} from '@evo/chat-core';
import { Config } from './path/to/core/config';
const { KOMORA_URL } = Config.data.appState

const swindonObj = Swindon('/ws');

const besida = new Besida(swindonObj, BESIDA_ROLE_COMPANY, KOMORA_URL, IS_DEBUG);

besida.registerHandler('message', (topic, message) => action());
besida.registerHandler('error', (_, error) => action());

await besida.connect();

await besida.chatList();

Till that time, u will have besida.store filled with chats data. Basicly store is readonly propety, dont try to change it, mutation will be cleared, after first interaction with ws. One more thing about store, is that is in immutableJS, so it's convenient to use with Redux and similar rendering technologies. You can provide, mutableStore=true, so it becomes plain js object, but it doesn't mean u can mutate it. Utils, works only with mutable store for now, will be improved with nearest minor version.

Send message

const currentChatRoom = besida.store.get(['chats']).first();

await besida.sendMessage(
    currentChatRoom.get('room_ident'), msgBody, platfrom, source, device
);

Try - catch block is unnesessary, all errors from Besida will go in ur callback error function.