UnknownEvent
An event type SDK fallbacks to if incoming event was failed to be decoded as a system event.
public struct UnknownEvent: Event, Hashable
Inheritance
Decodable
, Event
, Hashable
Initializers
init(from:)
public init(from decoder: Decoder) throws
Properties
type
An event type.
public let type: EventType
cid
A channel identifier the event is observed in.
public let cid: ChannelId
userId
A user identifier the event is sent by.
public let userId: UserId
createdAt
An event creation date.
public let createdAt: Date
Methods
payload(ofType:)
Decodes a payload of the given type from the event.
func payload<T: CustomEventPayload>(ofType: T.Type) -> T?
Parameters
ofType
: The type of payload the custom fields should be treated as.
Returns
A payload of the given type if decoding succeeds and if event type matches the one declared in custom payload type. Otherwise nil
is returned.