【m】优化socket代码
This commit is contained in:
@@ -20,6 +20,10 @@ namespace Unity.RenderStreaming
|
||||
handler.onGotAnswer += OnGotAnswer;
|
||||
handler.onAddChannel += OnAddChannel;
|
||||
handler.onAddTransceiver += OnAddReceiver;
|
||||
handler.onParticipantJoined += OnParticipantJoined;
|
||||
handler.onParticipantLeft += OnParticipantLeft;
|
||||
handler.onCallRequest += OnCallRequest;
|
||||
handler.onMessage += OnMessage;
|
||||
}
|
||||
|
||||
public bool Subscribe(Component comp)
|
||||
@@ -137,5 +141,46 @@ namespace Unity.RenderStreaming
|
||||
};
|
||||
ExecuteEventToAllTargets(data, ExecuteSignalingEvents.addReceiverHandler);
|
||||
}
|
||||
|
||||
private void OnParticipantJoined(string connectionId, string participantId)
|
||||
{
|
||||
var data = new SignalingEventData(EventSystem.current)
|
||||
{
|
||||
connectionId = connectionId,
|
||||
participantId = participantId
|
||||
};
|
||||
ExecuteEventToAllTargets(data, ExecuteSignalingEvents.participantJoinedHandler);
|
||||
}
|
||||
|
||||
private void OnParticipantLeft(string connectionId, string participantId)
|
||||
{
|
||||
var data = new SignalingEventData(EventSystem.current)
|
||||
{
|
||||
connectionId = connectionId,
|
||||
participantId = participantId
|
||||
};
|
||||
ExecuteEventToAllTargets(data, ExecuteSignalingEvents.participantLeftHandler);
|
||||
}
|
||||
|
||||
private void OnCallRequest(string connectionId, string callData)
|
||||
{
|
||||
var data = new SignalingEventData(EventSystem.current)
|
||||
{
|
||||
connectionId = connectionId,
|
||||
message = callData
|
||||
};
|
||||
ExecuteEventToAllTargets(data, ExecuteSignalingEvents.callRequestHandler);
|
||||
}
|
||||
|
||||
private void OnMessage(string connectionId, string participantId, string message)
|
||||
{
|
||||
var data = new SignalingEventData(EventSystem.current)
|
||||
{
|
||||
connectionId = connectionId,
|
||||
participantId = participantId,
|
||||
message = message
|
||||
};
|
||||
ExecuteEventToAllTargets(data, ExecuteSignalingEvents.messageHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user