WEB message push—GoEasy

The technology of web real-time push is used in most projects, especially some projects with high real-time requirements. There are many implementation technologies in this area, similar to webscoket, dwr, comet4j and netpush, etc. Here I also introduced dwr. The biggest advantage of the above technical implementation is that it is free and self-developed, but it is not compatible with some mainstream browsers. Delay, even the above technologies cannot be pushed in some browsers, debugging compatibility is a bad news, the other is that whether the above technologies are based on long connections or long polling will occupy your server performance. I recommend a good web message push service - goeasy

For documentation and information about goeasy, you can go to the official website http://goeasy.io/   . This is a paid product and will give you a 3-month free trial period. There are price details for different concurrency and number of messages sent. This is not repeated here.

The first step is to go to the official website to register an account, create an application, divided into free trial and paid, after creating a key

The second step is to introduce dependencies in your java project pom file

[html]  view plain copy  
  1. <repositories>  
  2.           
  3.         ...  
  4.          <!-- GoEasy message push -->  
  5.         <repository>  
  6.            <id>goeasy</id>  
  7.            <name>goeasy</name>  
  8.            <url>http://maven.goeasy.io/content/repositories/releases/</url>  
  9.         </repository>  
  10.           
  11.  </repositories>  
  12. </dependencies>  
  13.      ...  
  14.  <!-- GoEasy message push -->  
  15.     <dependency>  
  16.       <groupId>io.goeasy</groupId>  
  17.       <artifactId>goeasy-sdk</artifactId>  
  18.       <version>0.3.5</version>  
  19.     </dependency>  
  20. </dependencies>  

The third step is to publish the channel in your java background, the channel can be unlimited

[java]  view plain copy  
  1. GoEasy goEasy =  new  GoEasy( "your key" );  
  2. goEasy.publish( "Channel name" , "Popup message prompt" );  

The fourth step is in the jsp page you need to prompt

[javascript]  view plain copy  
  1. <script type="text/javascript" src="https://cdn.goeasy.io/goeasy.js"></script>  
  2. <script type="text/javascript">  
  3. var goEasy = new GoEasy({  
  4.         appkey:  "your key"  
  5.     });  
  6. goEasy.subscribe({  
  7.         channel: "c1-"+groupId+"-"+projectId+"-"+userId,  
  8.         onMessage: function (message) {  
  9.          if(confirm(message.content)){             
  10.             window.location.reload();  
  11.          }else{  
  12.             window.location.reload();  
  13.          }                
  14.         }        
  15.     });  
  16. </script>  

If you want to achieve precise push, push different messages to different users, get the current login id on the page, and use the id as the channel name when publishing the channel in the background.

You can also log in in the goeasy background to view the details of the channels you send and receive every day



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325858314&siteId=291194637