-
Notifications
You must be signed in to change notification settings - Fork 0
WsPlugin
Danny SMc edited this page Nov 2, 2021
·
2 revisions
The WS (WebSocket) plugin is a built-in plugin that comes with a full flow for building WebSocket-based services. The plugin is built on top of Express, and provides a simple solution for building powerful APIs with little effort.
The WS service comes with a HTTP and WS service, decorators, interfaces and types, middleware and more. You can find an example of it's usage through this guide about controllers.
- A service for the express web server.
- Express plugin called
express-ws
. - An action decorator for creating methods.
- A middleware interface for authentication.
- Context objects for accessing request data.
Below is an example of setting up the http plugin with the engine.
import { Engine, WsPlugin } from '@symbux/turbo';
const engine = new Engine({
autowire: true,
});
engine.use(new WsPlugin({
path: '/ws',
port: 80,
}));
Available options below.
Name | Type | Default | Description |
---|---|---|---|
path |
string |
/ws |
The path the websocket will listen on. |
port |
number |
null |
If the HttpPlugin is in use, then the WS server will attach to that, if not, it will require a port. |
options |
Record<string, any> |
{} |
WS Options to pass to the underlying WS server. |
- Controllers
- Middleware
- Autowire
- Plugins
- Tasks
- Fibres
- Authentication
- Registry
- Services
- Dependecy Injection
- Translations (i18n)
- Safe Quit
- Exception Handling
- Event Listener
- Custom Logger
- HTTP Plugin - Built-In
- WS Plugin - Built-In
- Discord Plugin - External
- Vite Plugin - External
- Inspect Plugin - External
- CLI Plugin - External
- Got an issue? Join our Discord
- Need your own plugin? Contact Me
- Have an idea? Let's Discuss
- Want to support me? Buy me a coffee