@epicgames-ps/lib-pixelstreamingsignalling-ue5.5
@epicgames-ps/lib-pixelstreamingsignalling-ue5.5 / StreamerConnection / StreamerConnection
Defined in: Signalling/src/StreamerConnection.ts:29
A connection between the signalling server and a streamer connection. This is where messages expected to be handled by the streamer come in and where messages are sent to the streamer.
Interesting internals: streamerId: The unique id string of this streamer. transport: The ITransport where transport events can be subscribed to protocol: The SignallingProtocol where signalling messages can be subscribed to. streaming: True when the streamer is ready to accept subscriptions.
EventEmitter
new StreamerConnection(
server
,ws
,remoteAddress
?):StreamerConnection
Defined in: Signalling/src/StreamerConnection.ts:54
Initializes a new connection with given and sane values. Adds listeners for the websocket close and error and will emit a disconnected event when disconneted.
The signalling server object that spawned this streamer.
WebSocket
The websocket coupled to this streamer connection.
string
The remote address of this connection. Only used as display.
EventEmitter.constructor
maxSubscribers:
number
Defined in: Signalling/src/StreamerConnection.ts:41
protocol:
SignallingProtocol
Defined in: Signalling/src/StreamerConnection.ts:35
optional
remoteAddress:string
Defined in: Signalling/src/StreamerConnection.ts:39
streamerId:
string
Defined in: Signalling/src/StreamerConnection.ts:31
streaming:
boolean
Defined in: Signalling/src/StreamerConnection.ts:37
subscribers:
Set
<string
>
Defined in: Signalling/src/StreamerConnection.ts:43
transport:
ITransport
Defined in: Signalling/src/StreamerConnection.ts:33
addListener(
eventName
,listener
):this
Defined in: Common/dist/types/Event/EventEmitter.d.ts:39
Alias for emitter.on(eventName, listener)
.
string
(...args
) => void
this
EventEmitter.addListener
emit(
eventName
, ...args
):boolean
Defined in: Common/dist/types/Event/EventEmitter.d.ts:133
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
string
...any
[]
boolean
EventEmitter.emit
getReadableIdentifier():
string
Defined in: Signalling/src/StreamerConnection.ts:80
Returns an identifier that is displayed in logs.
string
A string describing this connection.
IMessageLogger
.getReadableIdentifier
getStreamerInfo():
IStreamerInfo
Defined in: Signalling/src/StreamerConnection.ts:97
Returns a descriptive object for the REST API inspection operations.
An IStreamerInfo object containing viewable information about this connection.
off(
eventName
,listener
):this
Defined in: Common/dist/types/Event/EventEmitter.d.ts:88
Alias for emitter.removeListener()
.
string
(...args
) => void
this
EventEmitter.off
on(
eventName
,listener
):this
Defined in: Common/dist/types/Event/EventEmitter.d.ts:55
Adds the listener
function to the end of the listeners array for the event
named eventName
.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter
, so that calls can be chained.
string
The name of the event.
(...args
) => void
The callback function
this
EventEmitter.on
once(
eventName
,listener
):this
Defined in: Common/dist/types/Event/EventEmitter.d.ts:70
Adds a one-time listener
function for the event named eventName
. The
next time eventName
is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter
, so that calls can be chained.
string
The name of the event.
(...args
) => void
The callback function
this
EventEmitter.once
removeAllListeners(
eventName
):this
Defined in: Common/dist/types/Event/EventEmitter.d.ts:93
Removes all listeners, or those of the specified eventName
.
Returns a reference to the EventEmitter
, so that calls can be chained.
string
this
EventEmitter.removeAllListeners
removeListener(
eventName
,listener
):this
Defined in: Common/dist/types/Event/EventEmitter.d.ts:84
Removes the specified listener
from this EventEmitter.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
Returns a reference to the EventEmitter
, so that calls can be chained.
string
(...args
) => void
this
EventEmitter.removeListener
sendMessage(
message
):void
Defined in: Signalling/src/StreamerConnection.ts:88
Sends a signalling message to the player.
BaseMessage
The message to send.
void