Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
emit(event, ...data) {
if (this.readyState !== BaseSocketIO.OPEN) {
throw new Error('SocketIO is already in CLOSING or CLOSED state')
}
// Emulate connection by re-creating all objects
data = cloneDeepWith(data, cloneCustomiser)
const messageEvent = createMessageEvent({
type: event,
origin: this.url,
data
})
// Dispatch on self since the event listeners are added to per connection
this.dispatchEvent(messageEvent, ...data)
}