- 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!