1.页面js环境的引入
在页面我们需要引用动态的goeasy.js
注意:这个地方有的电脑会出现引入失败的问题,只需把这个src中的内容手动敲一遍即可,以为这个字符串中可能存在不可见的空字符。
添加goeasy仓库到自己的pom.xml
goeasy
goeasy
http://maven.goeasy.io/content/repositories/releases/
添加依赖到自己的maven仓库中
io.goeasy
goeasy-sdk
0.3.8
com.google.code.gson
gson
org.slf4j
slf4j-api
在服务器中发送消息
GoEasy goEasy = new GoEasy( "http(s)://
<你的rest host="">
”, "填写你自己的appkey"); goEasy.publish("my_channel","填写你要发送的消息!");
你的rest>
页面接收订阅消息
var goEasy = new GoEasy({ appkey: "my_appkey" }); goEasy.subscribe({ channel: "my_channel", onMessage: function (message) { alert("Channel:" + message.channel + " content:" + message.content); } });
至此goeasy的简单应用的搭建就算完成了。
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/229932.html原文链接:https://javaforall.net
