Coder Social home page Coder Social logo

Comments (1)

kscript avatar kscript commented on September 28, 2024

两种解决办法:
一、关闭本地数据库

NIM.getInstance({
    db: false
});

优点: 代码简单
缺点: 已读状态丢失(没有已读回执), 每次刷新都相当于换了一个新设备, 会推许多消息过来

二、主动断开连接
借助 document 的 visibilitychange 事件(页面可见性), window 的 focus/blur 事件(标签页焦点) 来进行 断开/重连, 重连后读取本地列表
优点: 没有方案一的缺点
缺点: 代码复杂, visibilitychange 在ie10-下不支持

from nim_web_demo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.