node的websockets监听unix_domain_socket
WebSockets listening on UNIX domain socket?
Server side:
1
2
3
4
5var http = require('http');
var WebSocketServer = require('ws').Server;
var server = http.createServer()
var wss = new WebSocketServer({ server : server});
server.listen('/tmp/server.sock')Client side:
1
2
3var ws = require('ws');
var client = new ws("ws+unix:///tmp/server.sock")
client.send('hello')
- 本文标题:node的websockets监听unix_domain_socket
- 本文作者:乔文飞
- 创建时间:2020-07-20 17:45:57
- 本文链接:http://www.feidom.com/2020/07/20/node的websockets监听unix-domain-socket/
- 版权声明:本博客所有文章为作者学习笔记,有转载其他前端大佬的文章。转载时请注明出处。