Skip to content

0.10.0

Latest
Compare
Choose a tag to compare
@hpx7 hpx7 released this 18 Oct 18:13
· 73 commits to develop since this release
  • Update events API and allow defining event types inside hathora.yml (#418)
# hathora.yml

types:
  SomeType:
    foo: string
events:
  myEvent: SomeType
  myOtherEvent: int
// server

ctx.sendEvent(HathoraEvents.myEvent, {foo: "bar"}, userId)
// client

export type HathoraEvent = {type: HathoraEvent.myEvent; val: SomeType} | {type: HathoraEvent.myEvent; val: SomeOtherType}

Breaking: If you were using ctx.sendEvent()/ctx.broadcastEvent() previously, you'll either need to define an events block or migrate to using the new default ctx.broadcastEvent(HathoraEventTypes.default, "stringEventData")

Thanks @IanSSenne for the contribution!