Skip to main content

Class: BasePushRoute

Defined in: service-core/src/routes/BasePushRoute.ts:41

The BasePushRoute class provides a base set of endpoints for implement client push notifications.

Exposed endpoints:

NameHTTP MethodWhat it does
connectUPGRADE /<base_path>/connectEstablishes a connection to the push notification system.
sendPOST /<base_path>/:idSends a push notification message to the channel with the given id

!!Note!! that the BasePushRoute is not automatically registered with a server by default. You must create your own class that extends AdminRoute and apply the desired base path with @Route().

Example​

import { BasePushRoute, RouteDecorators } from "@rapidrest/service-core";
const { Route } = RouteDecorators;

@Route("/push")
export class PushRoute extends BasePushRoute {}

Constructors​

Constructor​

new BasePushRoute(): BasePushRoute

Returns​

BasePushRoute

Methods​

connect()​

connect(sock, user): Promise<void>

Defined in: service-core/src/routes/BasePushRoute.ts:123

Parameters​

sock​

WebSocket

user​

any

Returns​

Promise<void>


send()​

send(id, msg, user): Promise<void>

Defined in: service-core/src/routes/BasePushRoute.ts:355

Parameters​

id​

string

msg​

any

user​

any

Returns​

Promise<void>