Skip to content

Instantly share code, notes, and snippets.

if let socket = self.socket, let encoded = try? JSONEncoder().encode(value.eventPayload(withSessionID: sessionID)), let dictionary = try? JSONSerialization.jsonObject(with: encoded, options: []) as? [String : Any] {
socket.emit("event", dictionary)
}
if let socket = self.socket, let encoded = try? JSONEncoder().encode(value.eventPayload(withSessionID: sessionID)), let dictionary = try? JSONSerialization.jsonObject(with: encoded, options: []) as? [String : Any] {
socket.emit("event", dictionary)
}