import socketIo from "socket.io" ; import { Server } from "http" ; let socket ; const setup = ( server ) : socketIo . Server => { if ( socket ) return socket ; socket = socketIo ( server ) ; return socket ; } ; const io = ( ) : socketIo . Server => socket ; export default { setup , io , } ;