<i id='75nwu'><tr id='75nwu'><dt id='75nwu'><q id='75nwu'><span id='75nwu'><b id='75nwu'><form id='75nwu'><ins id='75nwu'></ins><ul id='75nwu'></ul><sub id='75nwu'></sub></form><legend id='75nwu'></legend><bdo id='75nwu'><pre id='75nwu'><center id='75nwu'></center></pre></bdo></b><th id='75nwu'></th></span></q></dt></tr></i><div id='75nwu'><tfoot id='75nwu'></tfoot><dl id='75nwu'><fieldset id='75nwu'></fieldset></dl></div>
    <bdo id='75nwu'></bdo><ul id='75nwu'></ul>
  • <legend id='75nwu'><style id='75nwu'><dir id='75nwu'><q id='75nwu'></q></dir></style></legend>
    1. <small id='75nwu'></small><noframes id='75nwu'>

      <tfoot id='75nwu'></tfoot>

      1. 从 Web 服务器到客户端 bower 的实时通知

        Real time notification from web server to client bowers(从 Web 服务器到客户端 bower 的实时通知)
          <bdo id='OKiRl'></bdo><ul id='OKiRl'></ul>

            1. <tfoot id='OKiRl'></tfoot>

              <small id='OKiRl'></small><noframes id='OKiRl'>

                <tbody id='OKiRl'></tbody>
              <legend id='OKiRl'><style id='OKiRl'><dir id='OKiRl'><q id='OKiRl'></q></dir></style></legend>
              <i id='OKiRl'><tr id='OKiRl'><dt id='OKiRl'><q id='OKiRl'><span id='OKiRl'><b id='OKiRl'><form id='OKiRl'><ins id='OKiRl'></ins><ul id='OKiRl'></ul><sub id='OKiRl'></sub></form><legend id='OKiRl'></legend><bdo id='OKiRl'><pre id='OKiRl'><center id='OKiRl'></center></pre></bdo></b><th id='OKiRl'></th></span></q></dt></tr></i><div id='OKiRl'><tfoot id='OKiRl'></tfoot><dl id='OKiRl'><fieldset id='OKiRl'></fieldset></dl></div>

                • 本文介绍了从 Web 服务器到客户端 bower 的实时通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 php+mysql 开发约会中心 Web 应用程序.我目前尝试做的是在没有第三方推送器和不使用 jQuery SetInterval AJAX 请求的情况下,在从 Web 服务器向客户端/用户 bowers 进行约会时发送通知.我认为 SetInterval &AJAX 是一种糟糕的方法,因为客户端和服务器之间的流量会过多.

                  I am developing an appointments center web application using php+mysql. what I currently trying to do is to send notification when an appointment has been made from web server to client/user bowers without third party pushers and without using jQuery SetInterval AJAX request. I think SetInterval & AJAX is a bad approach because there would be too much traffic between the client and the server.

                  如何在不使用 SetInterval 轮询服务器的情况下实现通知?

                  How can I implement notifications without polling the server with SetInterval?

                  推荐答案

                  您可以使用 NodeJs 做到这一点.NodeJS 是您服务器上的 javascript,可实时将内容推送到连接的客户端.

                  You can do this using NodeJs. NodeJS is javascript on your server that pushes content to connected clients in real time.

                  它非常易于使用和设置.您需要一个专用于实时应用的服务器,我使用 http://nodejitsu.com.

                  Its really easy to use and setup. You need a server dedicated to the real time app, I use http://nodejitsu.com.

                  服务端

                  var app = require('http').createServer(handler)
                  , io = require('socket.io').listen(app)
                  , url = require('url')
                  
                  app.listen(8080);
                  
                  function handler (req, res) {
                  // parse URL
                  var requestURL = url.parse(req.url, true);
                  
                  // if there is a message, send it
                  if(requestURL.query.message)
                      sendMessage(decodeURI(requestURL.query.message));
                  
                  // end the response
                  res.writeHead(200, {'Content-Type': 'text/plain'});
                  res.end("");
                  }
                  
                  function sendMessage(message) {
                  io.sockets.emit('notification', {'message': message});
                  }
                  

                  客户端

                  <script src="socket.io.min.js"></script>
                  <script>
                  var socket = io.connect('http://localhost:8080');
                  socket.on('notification', function (data) {
                      console.log(data.message);
                  });
                  </script>
                  

                  我在下面添加了@intivev 的易于使用的示例,以完成未来读者的答案

                  I added the easy to use example by @intivev below to complete the answer for future readers

                  这篇关于从 Web 服务器到客户端 bower 的实时通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <i id='eY20g'><tr id='eY20g'><dt id='eY20g'><q id='eY20g'><span id='eY20g'><b id='eY20g'><form id='eY20g'><ins id='eY20g'></ins><ul id='eY20g'></ul><sub id='eY20g'></sub></form><legend id='eY20g'></legend><bdo id='eY20g'><pre id='eY20g'><center id='eY20g'></center></pre></bdo></b><th id='eY20g'></th></span></q></dt></tr></i><div id='eY20g'><tfoot id='eY20g'></tfoot><dl id='eY20g'><fieldset id='eY20g'></fieldset></dl></div>

                  • <legend id='eY20g'><style id='eY20g'><dir id='eY20g'><q id='eY20g'></q></dir></style></legend>

                        <small id='eY20g'></small><noframes id='eY20g'>

                            <tbody id='eY20g'></tbody>
                          • <bdo id='eY20g'></bdo><ul id='eY20g'></ul>
                          • <tfoot id='eY20g'></tfoot>