SapphireDb logo SapphireDb

Connection types

SapphireDb supports different types of connection. This makes client implementations very easy.
SapphireDb also supports older browsers with the connections.

Available connection types


Websocket is a modern technology for bi-directional data transfer. The server and client can push data through the connection.

Server sent events (SSE)

Server sent events use an open connection that can be used by the server to push data to the client. The client can send data using normal http requests.

Long polling

If the client does not support any of the other methods you can also switch to long polling. The data will be requested in a long running request. Data will be transferred through normal http requests.


This small demo changes the connection type of the whole application. You can test every section with the different connection types.

Set connection type

ng-sapphiredb automatically switches the connection type to one the client supports. You can also define it manually.
\f:(typescript:app.module.ts) @NgModule({\n \timports: [\n \t\tSapphireDbModule\n \t],\n \tproviders: [\n \t\t{\n \t\t\tprovide: SAPPHIRE_DB_OPTIONS,\n \t\t\tuseValue: {\n \t\t\t\tconnectionType: 'websocket' or 'sse' or 'poll'\n \t\t\t}\n \t\t}\n \t],\n })\n export class AppModule {}

This website uses Google Analytics. If you want to disable it just unselect the option: