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

@gdty/tim-npm-sdk

v1.1.1

Published

即时通讯SDK

Downloads

13

Readme

websocket json

主体使用 JzWebsocketJson

#拉取

yarn add @gdty/tim-npm-sdk
import {JzWebsocketJson} from '@gdty/tim-npm-sdk'

websocket可靠性优化

1、发送可靠性

主要对发送人发送信息后立刻响应信息,以作为是否发送成功的标志,发送失败时提醒。

2、接收可靠性

加入心跳机制和断线重连,后续加上聊天记录获取

关于Keep Alive心跳

通常来说,IM里的心跳指的是为了TCP或UDP通讯的socket保活而进行的定时向服务端发送keep alive包的机制。 一般来说Keep Alive心跳的作用至少有两个: 1)解决UDP或TCP的端口老化问题(UDP的端口老化时间更短); 2)告诉服务器我还活着(极端情况下,当客户端因程序崩溃等情况而非常退出时,心跳就显得特别重要,尤其在使用UDP这样的“无连接”协议的情况下)。

关于QOS

我们讲讲应答机制:

主流的IM(不管是IM云还是像微信这样的产品),都会这个消息应答机制(易信就特别明显,你甚至可以看到对方读消息的时间,也同样是用的应答机制),且无论是UDP协议还是TCP协议。应答机制通常是在消息接收者收到消息的同时,马上发送应答包,发送方只需根据这个应答包来决定对方是否真的是否“收到”消息,这就让丢包(当然丢包的情况有很多种可能,UDP协议自身的特殊性只是其中一种)的判定变的简单。

再来讲讲重传机制:

这个重传机制,跟你说的心跳是差不多的,但是用“心跳”可能容易跟Keep alive机制混淆,所以叫定时线程,可能更准确。它的工作原理是,定期检查已发送队列,当包的生存期已过,就表示这个包从未收到应答包,也就认为着它没有被接收方“收到”,那么自动触发重传机制。

http://www.52im.net/thread-129-1-2.html

http://www.52im.net/thread-294-1-1.html?spm=a2c6h.12873639.article-detail.4.2fe46f280ooUNa

http://www.52im.net/thread-594-1-1.html?spm=a2c6h.12873639.article-detail.5.2fe46f280ooUNa

#下一步

1、离线消息(推送)

2、已读未读

3、同步返回信息