Web Real-time Messaging backend server push technology goeasy (multi-lingual support)---with Goeasy Web Push instance

Source: Internet
Author: User

More and more projects need to use real-time message push and receive, how to achieve the most convenient? I recommend that you use the goeasy, it is a third-party push service platform, using its API can easily take care of real-time push!

Browser compatibility: goeasy push supports WebSocket and polling two connections to support all versions of IE6 and above, while also supporting other browsers such as firefox, Chrome, Safari, and More.

Support for different development languages: Goeasy push provides a RESTful API interface that enables real-time push through the restful api, regardless of which language your daemon Uses. Such as: Java, PHP, c #, Ruby, Python, c, C + +, asp.

Support backstage and front-end push: backstage with restful API, front desk with goeasy.js; The use is very simple!

Web Real-time Messaging backend server push Technology-goeasy

Let me introduce you to the steps of using goeasy:

1. You need to register an account with the Goeasy website and create an app that will generate two key:publish keys and subscribe keys by default when the app is Created.

2. Front-desk Real-time subscription and reception

Simply introduce Goeasy.js and then call Goeasy's Subscribe method to subscribe to a channel, either with publish key or subscribe key at the time of Subscription. The callback function of the subscribe parameter onmessage can receive the message in real Time.

3. Front-desk Real-time push

It is still necessary to introduce goeasy.js (if the page has already been introduced and not be introduced), and then call Goeasy's Publish method to push the message to the subscribed channel, with only publish key being Pushed.


4. Real-time push in the background

Call the Goeasy Restful API and post to the http://goeasy.io/goeasy/publish, along with the three necessary parameters:

Appkey:publish Key

Channel: the channel you subscribed to

Content: Push Contents

It's that Simple.

Below I have written a small instance of the post, the use of Java script in the Web page to subscribe, push, receive, and unsubscribe example, inside the Appkey with the Goeasy official demo appkey.

    <HTML>      <Head>      <title>Goeasy Test</title>            <Scripttype= "text/javascript"src= "https://cdn.goeasy.io/goeasy.js"></Script>      <Scripttype= "text/javascript">          if(typeofGoeasy!== 'undefined'){              varGoeasy= NewGoeasy ({appkey:'ba821151-e043-4dfb-a954-c73744c8d323', UserId:"222", Username:" a", Onconnected:function() {console.log ("Connect to Goeasy success."); }, ondisconnected:function() {console.log ("Disconnect to Goeasy server."); }, onconnectfailed:function(error) {console.log ("Connect to Goeasy failed, error code:"+Error.code+"Error message:"+error.content);          }              });          } Subscribe (); functionSubscribe () {goeasy.subscribe ({channel:'Notification', OnMessage:function(message) {console.log ('meessage received:'+message.content); }, onsuccess:function() {console.log ("Subscribe the Channel successfully."); }, onfailed:function(error) {console.log ("Subscribe the Channel failed, error code:"+Error.code+ "Error Message:"+error.content);                }                        }); }                             functionpublishmessage () {goeasy.publish ({channel:'Notification', Message:'you received a new notification', Onsuccess:function() {console.log ("Publish Message Success."); }, onfailed:function(error) {console.log ("Publish message failed, error code:"+Error.code+"Error message:"+error.content);                      }                  }); }                                   functionunsubscribe () {goeasy.unsubscribe ({channel:"Notification", Onsuccess:function() {console.log ("Cancel Subscription successfully."); }, onfailed:function(error) {console.log ("Cancel the subscrition failed, error code:"+Error.code+ "Error Message:"+error.content);                  }                            }); }                     </Script>      </Head>      <Body>        <inputtype= "button"value= "publish"onclick= "publishmessage ()"/>        <inputtype= "button"value= "unsubscribe"onclick= "unsubscribe ()"/>        <inputtype= "button"value= "subscribe"onclick= "subscribe ()"/>      </Body>      </HTML>  

Web Real-time Messaging backend server push technology goeasy (multi-lingual support)---with Goeasy Web Push instance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.