lance-gg / lance

Multiplayer game server based on Node.JS
https://lance-gg.github.io/
Apache License 2.0
1.58k stars 168 forks source link

ServerEngine without express/http server #102

Closed dev-zetta closed 5 years ago

dev-zetta commented 5 years ago

Hello there,

is it possible to have the ServerEngine initialized with socket.io instance without express/http server?

const socketIo = require(`socket.io`)
    let server = socketIo.listen(config.port, () => lll(`Listening on ${ config.port }`))
    this.server = new ServerEngine(socketIo, this.engine, {
      debug: {},
      updateRate: 6,
      timeoutInterval: 0 // no timeout
    })

It seems that Lance expects a HTTP server. When I call client.connect(), it does nothing (when autoconnect disabled). Also autoconnect doesn't work either.

Edit: There is a serverURL option. Should I set it to localhost? Edit2: I had to explicitly set serverURL parameter: serverURL: 'ws://127.0.0.1:3000'