对于一个单页面应用或者一个Web页面,只需要初始化一个GoEasy对象。
为了能够在任何页面随时随地的调用goeasy对象,强烈建议将goeasy对象声明为全局对象。
<script type="text/javascript" src="https://cdn.goeasy.io/goeasy-2.4.7.min.js"></script>
//初始化
var goeasy = GoEasy.getInstance({
host:"hangzhou.goeasy.io", //若是新加坡区域:singapore.goeasy.io
appkey:"您的common key",
modules:['pubsub']//根据需要,传入‘pubsub’或'im’,或数组方式同时传入
});