Ruby Web Real-Time Message backend server push technology --- GoEasy, ruby --- goeasy
More and more projects require real-time message pushing and receiving. How can we use Ruby to achieve the most convenient? We recommend that you use GoEasy, a third-party PUSH Service Platform. You can use its APIs to easily push messages in real time!
Browser compatibility: GoEasy push supports websocket and polling connection methods to support all versions of IE6 and later. It also supports other browsers such as Firefox, Chrome, and Safari.
Support for different development languages: GoEasy push provides Restful API interfaces. No matter which language your background program uses, you can use Restful API to implement real-time push in the background. For example, Java, PHP, C #, Ruby, Python, C, C ++, ASP. NET, Node. js...
Support for background and foreground push: Restful API is used in the background, and goeasy. js is used in the foreground. The application is very simple!
Ruby Web Real-Time Message backend server push technology-GoEasy
The following describes how to use GoEasy:
1. You need to register an account on the goeasy official website and create an application. After the application is created, the system will generate two keys for it by default: publish key and subscribe key.
2. Real-time subscription and receipt at the front-end
You only need to introduce goeasy. js and call the goeasy subscribe method to subscribe to a channel. You can use either publish key or subscribe key to subscribe to a channel. The onMessage callback function of the subscribe parameter can receive messages in real time.
3. Real-time push at the front end
You still need to introduce goeasy. js (if the page has already been introduced, it can not be introduced), and then call the goeasy publish method to push messages to the subscribed channel. only publish key can be used for pushing messages.
4. Real-time push in the background
Call the GoEasy Restful API to access the http://goeasy.io/goeasy/publish in post mode, and also need to include three necessary parameters:
Appkey: publish key
Channel: the channel you subscribed
Content: Push content
That's simple.
Below I will post a small instance I wrote earlier, which uses Javascript to subscribe, push, receive, and unsubscribe on the web page, the appkey is the appkey of the goeasy official demo.