扫码关注官方订阅号
各位专家好:
为什么我在用sort时的结果不正确呢?最后一个数据为什么没有参与排序? 谢谢!
小伙看你根骨奇佳,潜力无限,来学PHP伐。
nodejs代码:
var wsc = []; var server = require("http").createServer(); var ws = require('ws'); server.listen(3000); wss = new ws.Server({ "server" : server }); wss.on("connection", function(connection) { /* 如何能知道CONNECTION的客户端IP地址?URL等信息? */ console.log("INFO:输入[" + connection + "]"); /* 2015/6/3 */ wsc.push(connection); if (wsc.length > 1) { data = JSON.stringify({ "event" : "login" }); connection.send(data); } connection.on("message", function(message) { for ( var int = 0; int < wsc.length; int++) { try { if (wsc[int] != connection) { wsc[int].send(message); } } catch (e) { } } }); });
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
nodejs代码: