forked from ppfun/pixelplanet
make wsupgrade async
This commit is contained in:
parent
5c353dd8c2
commit
bfa3e19c2c
|
@ -43,11 +43,11 @@ const server = http.createServer(app);
|
|||
// -----------------------------------------------------------------------------
|
||||
const usersocket = new SocketServer();
|
||||
const apisocket = new APISocketServer();
|
||||
function wsupgrade(request, socket, head) {
|
||||
async function wsupgrade(request, socket, head) {
|
||||
const { pathname } = url.parse(request.url);
|
||||
try {
|
||||
if (pathname === '/ws') {
|
||||
usersocket.handleUpgrade(request, socket, head);
|
||||
await usersocket.handleUpgrade(request, socket, head);
|
||||
} else if (pathname === '/mcws') {
|
||||
apisocket.handleUpgrade(request, socket, head);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user