phpwebsocket

码农软件 · 软件分类 · WebSocket开发包 · 2019-04-18 06:41:43

软件介绍

从名字上也可看出,这是一个 WebSocket 的 PHP 实现。

示例客户端代码:

var host = "ws://localhost:12345/websocket/server.php";
try{
  socket
= new WebSocket(host);
  log
('WebSocket - status '+socket.readyState);
  socket
.onopen    = function(msg){ log("Welcome - status "+this.readyState); };
  socket
.onmessage = function(msg){ log("Received: "+msg.data); };
  socket
.onclose   = function(msg){ log("Disconnected - status "+this.readyState); };
}
catch(ex){ log(ex); }

 

示例服务器端代码:

log("Handshaking...");
list
($resource,$host,$origin) = getheaders($buffer);
$upgrade
= "HTTP/1.1 101 Web Socket Protocol Handshake\r\n" .
           
"Upgrade: WebSocket\r\n" .
           
"Connection: Upgrade\r\n" .
           
"WebSocket-Origin: " . $origin . "\r\n" .
           
"WebSocket-Location: ws://" . $host . $resource . "\r\n" .
           
"\r\n";
$handshake
= true;
socket_write
($socket,$upgrade.chr( ),strlen($upgrade.chr( )));

本文地址:https://www.codercto.com/soft/d/3823.html

iBATIS实战

iBATIS实战

(加)Clinton Begin、(加)Brandon Goodin、(加)Larry Meadors / 叶俊 / 人民邮电出版社 / 2008-5 / 45.00元

《图灵程序设计丛书•Java系列•iBATIS in Action iBATIS实战》是讲述iBATIS框架的权威著作。书中既详实地介绍了iBATIS的设计理念和基础知识,也讨论了动态SQL、高速缓存、DAD框架等高级主题,还讲解了iBATIS在实际开发中的应用。《图灵程序设计丛书•Java系列•iBATIS in Action iBATIS实战》的最后给出了一个设计优雅、层次清晰的示例程序JGa......一起来看看 《iBATIS实战》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具