导语:
以前接手过一个H5与安卓客户端进行长连接的及时聊天直播项目,于是今天抽空整理一下与H5长连接的笔记,希望朋友们能够更快速的跳过这些坑。
举例说明:
这个项目是一个h5实现及时聊天页面,功能类似直播中的与直播人员互动,聊天。
我们在开发客户端时候,要与网页端的H5进行互动,但是我们一般的长连接还是Socket之类的,如何与H5与Android 客户端互动呢,用WebSocket。
WebSocket简介:
github地址:
https://github.com/crossbario/autobahn-android
//简单阐述了Autobahn能够实现Android客户端 与webSocket这种协议
Autobahn|Android is a subproject of the Autobahn project and provides an open-source implementation
The WebSocket Protocol
The Web Application Messaging Protocol (WAMP)
for Android.
WebSocket allows bidirectional real-time messaging