GoEasy介绍
GoEasy专注于服务器与浏览器,浏览器与浏览器之间消息推送,完美兼容世界上的绝大多数浏览器,包括IE6, IE7之类的非常古老的浏览器。 GoEasy采用 发布/订阅 的消息模式,帮助您非常轻松的实现一对一,一对多的通信。
工作流程:
浏览器订阅channel。
向channel发布消息,不论是服务器还是客户端均可以向channel发布消息。
当客户端或者服务器向channel上发布一条消息时,所有订阅该channel的浏览器均可以收到该消息。
服务器发送消息REST
Host
杭州: rest-hangzhou.goeasy.io
新加坡: rest-singapore.goeasy.io
RESTful API
URL:http(s)😕//publish
回值:{
“code” : 200,
“content” : “OK”
}
返回值的详细说明,请参考附录A。
Java方式一: 手动下载sdkgoeasy-sdk.jar下载依赖包: gson-2.3.1.jar, slf4j-api-1.7.2.jar
方式二: Maven添加goeasy仓库到您的pom.xml文件:
<repositories>
...
<repository>
<id>goeasy</id>
<name>goeasy</name>
<url>
http://maven.goeasy.io/content/repositories/releases/
</url>
</repository>
</repositories>
然后添加依赖:
<dependencies>
...
<dependency>
<groupId>io.goeasy</groupId>
<artifactId>goeasy-sdk</artifactId>
<version>0.3.8</version>
</dependency>
</dependencies>
用Java在服务器端发送消息
GoEasy goEasy = new GoEasy( "http(s)://<REST Host>”, "my_appkey");
goEasy.publish("my_channel", "Hello, GoEasy!");
GoEasy是一款基于websocket的为服务器传送消息的框架,不同于原生的websocket,GoEasy可以支持多种版本,并且可以跨语言,能够快速进行开发。
官网地址:https://www.goeasy.io/cn/doc/presence/client-initial.html