# 即刻多端实时通信实践

DevFeed: [即刻多端实时通信实践](<https://devfeed.tech/articles/article-41012.md>)

Original publisher: [Read original article](<https://blog.joway.io/posts/socket-io/>)

Author: Joway

Published: 2018-09-18T00:00:00Z

Content type: article

Language: zh

Sources: [Random Thoughts](<https://devfeed.tech/sources/random-thoughts.md>)

Topics: [Socket.IO](<https://devfeed.tech/topics/socket-io.md>), [WebSocket](<https://devfeed.tech/topics/websocket.md>), [Redis](<https://devfeed.tech/topics/redis.md>), [Load Balancing](<https://devfeed.tech/topics/load-balancing.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [channel](<https://devfeed.tech/tags/channel.md>), [clients](<https://devfeed.tech/tags/clients.md>), [cluster](<https://devfeed.tech/tags/cluster.md>), [load-balancing](<https://devfeed.tech/tags/load-balancing.md>), [nodejs](<https://devfeed.tech/tags/nodejs.md>), [redis](<https://devfeed.tech/tags/redis.md>), [room](<https://devfeed.tech/tags/room.md>), [socket](<https://devfeed.tech/tags/socket.md>), [tech](<https://devfeed.tech/tags/tech.md>), [websocket](<https://devfeed.tech/tags/websocket.md>)

## AI overview

This Chinese technical article explains how Jike's jike-io real-time communication infrastructure is built with socket.io. It describes server-to-client WebSocket notifications, per-user rooms, HTTP requests for business operations, socket.io's fallback and reconnection behavior, and Redis-based distribution across nodes, including sticky load balancing and the associated message-broadcast overhead. It also discusses connection spikes and Node.js bottlenecks.

## Source excerpt

背景 jike-io 是即刻基于 socket.io 构建的一个实时通信基础设施。目前客户端上的所有实时通信服务都是建立在其基础上，涵盖了私信、消息通知、用户反馈、活动页小游戏等诸多组件。 在目前即刻的实时通信设计里，我们的实时通信只是为了让服务端主动推送消息给客户端，客户端不会主动通过 websocket 发送消息。由于几乎我们所有需要发送消息的请求都会有一定业务逻辑在，而这个业务逻辑我们并不希望 websocket 连接层(jike-io)去处理，所以我们仍旧采用传统 HTTP 请求的方式去发送请求。至于之后是否需要推送消息给用户，由服务端调用 jike-io 的接口进行实现。