func BuildServer(dbpath string) *GambitServer { var services = goservice.NewServiceCollection() var server = goservice.NewServer(services, goservice.BasicSessionCreator) var websocketEndpoint = goservice.NewWebsocketEndpoint(":4567", server) websocketEndpoint.Handler = GameMessageHandler server.AddEndpoint(websocketEndpoint) return &GambitServer{ *server, loge.NewLogeDB(loge.NewLevelDBStore(dbpath)), } }
func buildServer() *server.DriftServer { var db = loge.NewLogeDB(loge.NewLevelDBStore("data/sandbox")) db.CreateType(loge.NewTypeDef("sector", 1, §ors.Sector{})) db.CreateType(loge.NewTypeDef("account", 1, &accounts.Account{})) db.CreateType(loge.NewTypeDef("ship", 1, &ships.Ship{})) var locDef = loge.NewTypeDef("shiplocation", 1, &simulation.PoweredBody{}) locDef.Links = loge.LinkSpec{"sector": "sector"} db.CreateType(locDef) serviceCollection := goservice.NewServiceCollection() serviceCollection.AddService(services.GetAccountService()) serviceCollection.AddService(services.GetSectorService()) serviceCollection.AddService(services.GetShipService()) serviceCollection.AddService(loge.GetService()) return server.NewDriftServer(db, serviceCollection) }