sendAndWaitMessage function
Future<SocketData?>
sendAndWaitMessage(
- WebSocketListener socketListener,
- SocketData socketData, {
- String? waitingID,
- String? waitingType,
- bool anyID = false,
- bool anyType = false,
- Function? onError,
- Function? onTimeout,
Send and wait message with defined web socket
Implementation
Future<SocketData?> sendAndWaitMessage(
WebSocketListener socketListener, SocketData socketData,
{String? waitingID,
String? waitingType,
bool anyID = false,
bool anyType = false,
Function? onError,
Function? onTimeout}) async {
try {
// print("SEND AND WAIT MESSAGE IN : ${socketData.fullData}");
sendMessage(socketListener.client, socketData, onError: onError);
} on Exception {
//TODO: ADD ERROR
return null;
}
return waitMessage(
socketListener.socketBroadcast,
id: waitingID != null
? waitingID
: anyID
? null
: socketData.messageId,
type: waitingType != null
? waitingType
: anyType
? null
: socketData.type,
);
}