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 usersocket = new SocketServer();
|
||||||
const apisocket = new APISocketServer();
|
const apisocket = new APISocketServer();
|
||||||
function wsupgrade(request, socket, head) {
|
async function wsupgrade(request, socket, head) {
|
||||||
const { pathname } = url.parse(request.url);
|
const { pathname } = url.parse(request.url);
|
||||||
try {
|
try {
|
||||||
if (pathname === '/ws') {
|
if (pathname === '/ws') {
|
||||||
usersocket.handleUpgrade(request, socket, head);
|
await usersocket.handleUpgrade(request, socket, head);
|
||||||
} else if (pathname === '/mcws') {
|
} else if (pathname === '/mcws') {
|
||||||
apisocket.handleUpgrade(request, socket, head);
|
apisocket.handleUpgrade(request, socket, head);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user