文件名称:astro-spacesocket-a5dead8
- 所属分类:
- Internet/网络编程
- 资源属性:
- [JavaScript] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 14kb
- 下载次数:
- 0次
- 提 供 者:
- dodop*****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
WebSockets From Space*
* There are no users in space, only astronauts with the latest browser. Therefore no graceful fallback is attempted.
API
Setup
var server = http.createServer(...)
server.listen(port)
require( spacesocket ).attach(server, function(conn) {
dealWithWebSocket(conn)
})
Reading
conn.on( data , function(msg) {
doStuffWithString(msg)
})
Writing
conn.write( Hello, World )
Closure
conn.end()
Buffer control
conn.on( drain , function() {
// socket write queue is empty,
// send until queueing again:
while(conn.send(data)) { }
})
// Throttle sender for 1s:
conn.pause()
setTimeout(function() { conn.resume() }, 1000)
-WebSockets From Space*
* There are no users in space, only astronauts with the latest browser. Therefore no graceful fallback is attempted.
API
Setup
var server = http.createServer(...)
server.listen(port)
require( spacesocket ).attach(server, function(conn) {
dealWithWebSocket(conn)
})
Reading
conn.on( data , function(msg) {
doStuffWithString(msg)
})
Writing
conn.write( Hello, World )
Closure
conn.end()
Buffer control
conn.on( drain , function() {
// socket write queue is empty,
// send until queueing again:
while(conn.send(data)) { }
})
// Throttle sender for 1s:
conn.pause()
setTimeout(function() { conn.resume() }, 1000)
* There are no users in space, only astronauts with the latest browser. Therefore no graceful fallback is attempted.
API
Setup
var server = http.createServer(...)
server.listen(port)
require( spacesocket ).attach(server, function(conn) {
dealWithWebSocket(conn)
})
Reading
conn.on( data , function(msg) {
doStuffWithString(msg)
})
Writing
conn.write( Hello, World )
Closure
conn.end()
Buffer control
conn.on( drain , function() {
// socket write queue is empty,
// send until queueing again:
while(conn.send(data)) { }
})
// Throttle sender for 1s:
conn.pause()
setTimeout(function() { conn.resume() }, 1000)
-WebSockets From Space*
* There are no users in space, only astronauts with the latest browser. Therefore no graceful fallback is attempted.
API
Setup
var server = http.createServer(...)
server.listen(port)
require( spacesocket ).attach(server, function(conn) {
dealWithWebSocket(conn)
})
Reading
conn.on( data , function(msg) {
doStuffWithString(msg)
})
Writing
conn.write( Hello, World )
Closure
conn.end()
Buffer control
conn.on( drain , function() {
// socket write queue is empty,
// send until queueing again:
while(conn.send(data)) { }
})
// Throttle sender for 1s:
conn.pause()
setTimeout(function() { conn.resume() }, 1000)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
astro-spacesocket-a5dead8
.........................\LICENSE
.........................\README.md
.........................\lib
.........................\...\connection.js
.........................\...\framing.js
.........................\...\oldFraming.js
.........................\...\spacesocket.js
.........................\speedtest
.........................\.........\client.js
.........................\.........\graph.js
.........................\.........\index.html
.........................\.........\server.js
.........................\test
.........................\....\framing.test.js
.........................\....\oldFraming.test.js
.........................\....\spacesocket.test.js
.........................\LICENSE
.........................\README.md
.........................\lib
.........................\...\connection.js
.........................\...\framing.js
.........................\...\oldFraming.js
.........................\...\spacesocket.js
.........................\speedtest
.........................\.........\client.js
.........................\.........\graph.js
.........................\.........\index.html
.........................\.........\server.js
.........................\test
.........................\....\framing.test.js
.........................\....\oldFraming.test.js
.........................\....\spacesocket.test.js