Page Contents
Home > @loopback/socketio > socketio > subscribe
socketio.subscribe() function
Decorate a method to subscribe to socketio events. For example,
@socketio.subscribe('chat message')
async function onChat(msg: string) {
}
Signature:
function subscribe(...messageTypes: (string | RegExp)[]): MethodDecorator;
Parameters
Parameter | Type | Description |
---|---|---|
messageTypes | (string | RegExp)[] |
Returns:
MethodDecorator