Home > @rainway/web > StreamEvents
StreamEvents interface
Signature:
export interface StreamEvents
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
"before-input" | (input: RainwayInputEvent) => void | Promise<void> | Raised when an input (keyboard, mouse, gamepad...) is about to be sent to the remote device. Only input attempts enabled by the stream's InputLevel cause You can listen to this event and call |
myStream.addEventListener("beforeinput", (event) => {
const { input, heldKeys } = event;
if (input.type === "keyboard" && input.key === VirtualKey.Q) {
// Block the input, but send a message instead.
event.preventDefault();
if (input.action === KeyboardAction.Down) {
myStream.host.send(makeCoolRequest());
}
}
});
This should not be used to prevent security-sensitive key combinations like Alt+Tab. Instead, the remote host can filter \_incoming\_ inputs. See https://docs.rainway.com/docs/input-filtering for more info.
| | [close](./web-sdk-streamevents-close) | | () => void \| Promise<void> | Raised when the remote closes the stream. | | [stats](./web-sdk-streamevents-stats) | | (stats: [StatsSummary](./web-sdk-statssummary)) => void \| Promise<void> | Raised periodically during the stream, and provides various statistics about stream performance. |