

# getSocketEvents

<div class="api-docs__separator" data-reactroot="">

---

</div><div class="api-docs__import" data-reactroot="">

```ts
import { getSocketEvents } from "@hyper-fetch/sockets"
```

</div><div class="api-docs__section">

## Description

</div><div class="api-docs__description"><span class="api-docs__do-not-parse">



</span></div><p class="api-docs__definition">

Defined in [socket/socket.events.ts:21](https://github.com/BetterTyped/hyper-fetch/blob/c44d728f/packages/sockets/src/socket/socket.events.ts#L21)

</p><div class="api-docs__section">

## Preview

</div><div class="api-docs__preview fn">

```ts
getSocketEvents(eventEmitter)
```

</div><div class="api-docs__section">

## Parameters

</div><div class="api-docs__parameters"><table><thead><tr><th>Name</th><th>Details</th></tr></thead><tbody><tr param-data="eventEmitter"><td class="api-docs__param-name required">

### eventEmitter 

`Required`

</td><td class="api-docs__param-type">

`EventEmitter`

</td></tr></tbody></table></div><div class="api-docs__section">

## Returns

</div><div class="api-docs__returns">

```ts
{
  emitClose: () => void;
  emitConnecting: () => void;
  emitEmitterEvent: (emitter: EmitterType) => void;
  emitError: (event: ResponseType) => void;
  emitListenerEvent: (name: string, data: ResponseType, event: MessageEvent<ResponseType>) => void;
  emitListenerRemoveEvent: (name: string) => void;
  emitOpen: () => void;
  emitReconnecting: (attempts: number) => void;
  emitReconnectingStop: (attempts: number) => void;
  onClose: (callback: () => void) => VoidFunction;
  onConnecting: (callback: () => void) => VoidFunction;
  onEmitterEvent: (callback: (emitter: EmitterType) => void) => VoidFunction;
  onEmitterEventByName: (emitter: EmitterType, callback: (emitter: EmitterType) => void) => VoidFunction;
  onError: (callback: (event: ResponseType) => void) => VoidFunction;
  onListenerEvent: (callback: (data: ResponseType, event: MessageEvent<ResponseType>) => void) => VoidFunction;
  onListenerEventByName: (listener: ListenerType, callback: (data: ExtractListenerResponseType<ListenerType>, event: MessageEvent<ExtractListenerResponseType<ListenerType>>) => void) => VoidFunction;
  onListenerRemove: (callback: (name: string) => void) => VoidFunction;
  onListenerRemoveByName: (listener: ListenerType, callback: () => void) => VoidFunction;
  onOpen: (callback: () => void) => VoidFunction;
  onReconnecting: (callback: (attempts: number) => void) => VoidFunction;
  onReconnectingStop: (callback: (attempts: number) => void) => VoidFunction;
}
```

</div>