💿 Created a socket mixin
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
import { Server } from "socket.io";
|
||||
import { createServer } from "http";
|
||||
|
||||
export const SocketIOMixin = () => {
|
||||
|
||||
const socketServer = createServer();
|
||||
socketServer.listen(3001, `0.0.0.0`);
|
||||
const socketIOConnection = new Server(socketServer, {
|
||||
cors: {
|
||||
origin: "*",
|
||||
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
|
||||
preflightContinue: false,
|
||||
optionsSuccessStatus: 204,
|
||||
},
|
||||
});
|
||||
return socketIOConnection;
|
||||
}
|
||||
Reference in New Issue
Block a user