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

obvyazka

v0.0.12

Published

Obvyazka

Downloads

4

Readme

Obvyazka (2)

Installation:

npm install obvyazka

Usage:

var o = require('obvyazka');
var server = o.createServer( function(oc) {
  oc.on('auth', function(authObj) {
    if (checkLoginToken(authObj.uid, authObj.token)) {
      oc.on('action', actionHandler);
    } else {
	  oc.send('authError', {});
	  oc.close();
	}
  });
});
server.listen([ 
		{type:"TCP", ip:"192.234.15.1", port:"443"},
		{type:"TCP", ip:"192.234.15.1", port:"8080"},
		{type:"TCP", ip:"192.234.15.2", port:"80"},
		{type:"TCP", ip:"192.234.15.2", port:"8080"},
		{type:"TCP", ip:"192.234.15.2", port:"443"},
		{type:"HTTP", ip:"192.234.15.3", port:"80"}
]);	

About:

This is second version of Obvyazka. So all entities we call with prefix o2. For example, o2-server, o2-connection, o2-transport etc.

Main purpose of Obvyazka is comfortable work with sockets in multiplayer games. But you can use it in other apps. Obvyazka is library that allows you to use one universal o2-server and works with o2-connection instead a set of different TCP- and HTTP-servers. Obvyazka can safely reopen sockets and fall back to HTTP-requests, if sockets are not available. Obvyazka deals with messages, not bytes and sockets, so you can forget about fragmenting and defragmenting data in 'data' events.

Inside of Obvyazka:

When you are using send(type, msg), all messages translates in some series of bytes with header, length of message, type of serialization etc. There are 6 different type of message transfer in Obvyazka. This info is usefull, when you works with huge number of messages and economy in header size and data representation is critical for perfomance.

Other application of this info is writing your own Obvyazka-client on other languages. Right now you can use AS3-client code.

Types of messages and format in bytes:

Small messages:

U - UTF-string < 65536 bytes. Type of message - 2 chars.

[U][LN][TY][ DATA              ....   ]

U    = 1 byte.   'U' character.
LN   = 2 bytes.  Length of DATA sector. Short (16 bit) unsigned int. LSB.
TY   = 2 bytes.  Type of message.
DATA = LN bytes. UTF-String

R - RAW. Byte array < 65536 bytes. Type of message - 2 chars.

[R][LN][TY][ DATA              ....   ]

R    = 1 byte.   'R' character.
LN   = 2 bytes.  Length of DATA sector. Short (16 bit) unsigned int. LSB.
TY   = 2 bytes.  Type of message.
DATA = LN bytes. Binary data.

Typical messages:

S - UTF-string < 2Gb. Type of message - any string.

[S][LT][TYPE ... ][LENG][ DATA              ....   ]

S      = 1 byte.   'S' character.
LT     = 2 bytes.  Length of type. Short (16 bit) unsigned int. LSB.
TYPE   = LT bytes. Type of message.
LENG   = 4 bytes.  Length of DATA sector. 32-bit unsigned int. LSB.
DATA   = LN bytes. UTF-String.

J - JSON-string < 2Gb. Type of message - any string.

[J][LENG][ DATA              ....   ]

J      = 1 byte.   'J' character.
LENG   = 4 bytes.  Length of DATA sector. 32-bit unsigned int. LSB.
DATA   = LN bytes. UTF-String with JSON like {"type":sendedObject}

B - BIGBINARY. Byte array < 2Gb. Type of message - any string.

[B][LT][TYPE ... ][LENG][ DATA              ....   ]

B      = 1 byte.   'B' character.
LT     = 2 bytes.  Length of type. Short (16 bit) unsigned int. LSB.
TYPE   = LT bytes. Type of message.
LENG   = 4 bytes.  Length of DATA sector. 32-bit unsigned int. LSB.
DATA   = LN bytes. Binary data.

Tiny messages (no header):

a..z - SMALL messages. Length is fixed for all tiny messages.

[?][ DATA         ....   ]

?    = 1 byte.   'a' .. 'z' character. This is a type of message.
DATA = 20 bytes. Binary data. Default length is 20 bytes. But you can change this value in server settings.