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

@noear/socket.d

v2.5.13

Published

@noear/socket.d typescript project

Downloads

112

Readme

基于事件和语义消息流的网络应用层协议。

有用户说,“Socket.D 之于 Socket,尤如 Vue 之于 Js、Mvc 之于 Http”。支持 tcp, udp, ws, kcp 传输。

[len:int][flag:int][sid:str(<64)][\n][event:str(<512)][\n][metaString:str(<4k)][\n][data:byte(<16m)]

主要特性

  • 基于事件,每个消息都可事件路由
  • 所谓语义,通过元信息进行语义描述
  • 流关联性,来回相关的消息会串成一个流
  • 语言无关,使用二进制输传数据(支持 tcp, ws, udp)。支持多语言、多平台
  • 断线重连,自动连接恢复
  • 多路复用,一个连接便可允许多个请求和响应消息同时运行
  • 双向通讯,单链接双向互听互发
  • 自动分片,数据超出 16Mb(大小可配置),会自动分片、自动重组(udp 除外)
  • 接口简单,是响应式但用回调接口

体验效果 (for js-client)

//发送
session.send("/demo/hello", SocketD.newEntity("hi"));
//发送,且获取发送进度(如果有大数据发送,又需要显示进度)
session.send("/demo/upload", SocketD.newEntity(file)).thenProgress((isSend, val, max)=>{
    if(isSend){
        //获取发送进度
    }
});

//发送并请求,且同步等待
let reply = session.sendAndRequest("/demo/hello", SocketD.newEntity()).await();
//发送并请求,且取接收进度(如果有大数据获取,又需要显示进度)
session.sendAndRequest("/demo/download", SocketD.newEntity()).thenProgress((isSend, val, max)=>{
    if(!isSend){
        //获取接收进度
    }
}).thenReply(reply=>{
      //异步获取答复
}).thenError(err=>{
      //如果有出错?
});

//发送并订阅
let entity = SocketD.newEntity().range(5,5).metaPut("videoId","1");
session.sendAndSubscribe("/demo/stream", entity).thenReply(reply=>{
      //异步获取答复(会多次回调)
})