BridgePlugin
Extends:
OSC plugin for setting up communication between a Websocket client and a udp client with a bridge inbetween
Test:
Constructor Summary
Public Constructor | ||
public |
constructor(options: object) Create an OSC Bridge instance with given options. |
Member Summary
Private Members | ||
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
Method Summary
Public Methods | ||
public |
close() Close udp socket and Websocket server |
|
public |
Bind a udp socket to a hostname and port |
|
public |
send(binary: Uint8Array, customOptions: object) Send an OSC Packet, Bundle or Message. |
|
public |
Returns the current status of the connection |
Private Methods | ||
private |
registerNotify(fn: function) Internal method to hook into osc library's EventHandler notify method |
Inherited Summary
From class Plugin | ||
public |
close() Close socket connection and anything else used in the implementation. |
|
public |
Open socket connection. |
|
public |
send(binary: Uint8Array, customOptions: object) Send an OSC Packet, Bundle or Message. |
|
public |
Returns the current status of the connection |
Public Constructors
public constructor(options: object) source
Create an OSC Bridge instance with given options. Defaults to localhost:41234 for udp server, localhost:41235 for udp client and localhost:8080 for Websocket server
Override:
Plugin#constructorParams:
Name | Type | Attribute | Description |
options | object |
|
Custom options |
options.udpServer.host | string |
|
Hostname of udp server to bind to |
options.udpServer.port | number |
|
Port of udp server to bind to |
options.udpServer.exclusive | boolean |
|
Exclusive flag |
options.udpClient.host | string |
|
Hostname of udp client for messaging |
options.udpClient.port | number |
|
Port of udp client for messaging |
options.wsServer.host | string |
|
Hostname of Websocket server |
options.wsServer.port | number |
|
Port of Websocket server |
options.wsServer.server | http.Server | https.Server |
|
Use existing Node.js HTTP/S server |
options.receiver | string |
|
Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client |
Example:
const plugin = new OSC.BridgePlugin({ wsServer: { port: 9912 } })
const osc = new OSC({ plugin: plugin })
const http = require('http')
const httpServer = http.createServer();
const plugin = new OSC.BridgePlugin({ wsServer: { server: httpServer } })
const osc = new OSC({ plugin: plugin })
Private Members
Public Methods
public open(customOptions: object) source
Bind a udp socket to a hostname and port
Override:
Plugin#openParams:
Name | Type | Attribute | Description |
customOptions | object |
|
Custom options |
customOptions.host | string |
|
Hostname of udp server to bind to |
customOptions.port | number |
|
Port of udp server to bind to |
customOptions.exclusive | boolean |
|
Exclusive flag |
public send(binary: Uint8Array, customOptions: object) source
Send an OSC Packet, Bundle or Message. Use options here for custom receiver, otherwise the global options will be taken
Override:
Plugin#sendParams:
Name | Type | Attribute | Description |
binary | Uint8Array | Binary representation of OSC Packet |
|
customOptions | object |
|
Custom options |
customOptions.udpClient.host | string |
|
Hostname of udp client for messaging |
customOptions.udpClient.port | number |
|
Port of udp client for messaging |
customOptions.receiver | string |
|
Messages will be delivered to Websocket ('ws') clients or udp client ('udp') |