parseMessages(input, logger) {
        // The interface does allow "ArrayBuffer" to be passed in, but this implementation does not. So let's throw a useful error.
        if (typeof input !== "string") {
            throw new Error("Invalid input for JSON hub protocol. Expected a string.");
        }
        if (!input) {
            return [];
        }
        if (logger === null) {
            logger = _Loggers__WEBPACK_IMPORTED_MODULE_1__.NullLogger.instance;
        }
        // Parse the messages
        const messages = _TextMessageFormat__WEBPACK_IMPORTED_MODULE_2__.TextMessageFormat.parse(input);
        const hubMessages = [];
        for (const message of messages) {
            const parsedMessage = JSON.parse(message);
            if (typeof parsedMessage.type !== "number") {
                throw new Error("Invalid payload.");
            }
            switch (parsedMessage.type) {
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Invocation:
                    this._isInvocationMessage(parsedMessage);
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.StreamItem:
                    this._isStreamItemMessage(parsedMessage);
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Completion:
                    this._isCompletionMessage(parsedMessage);
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Ping:
                    // Single value, no need to validate
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Close:
                    // All optional values, no need to validate
                    break;
                default:
                    // Future protocol changes can add message types, old clients can ignore them
                    logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_4__.LogLevel.Information, "Unknown message type '" + parsedMessage.type + "' ignored.");
                    continue;
            }
            hubMessages.push(parsedMessage);
        }
        return hubMessages;
    }
/** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.
     *
     * @param {string} input A string containing the serialized representation.
     * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.
     */
Creates an array of  /signalr.HubMessage objects from the specified serialized representation.
@param {string} input A string containing the serialized representation.
@param {ILogger} logger A logger that will be used to log messages that occur during parsing.
Creates an array of / signalr . HubMessage objects from the specified serialized representation . @param { string } input A string containing the serialized representation . @param { ILogger } logger A logger that will be used to log messages that occur during parsing .
parseMessages(input, logger) {
        if (typeof input !== "string") {
            throw new Error("Invalid input for JSON hub protocol. Expected a string.");
        }
        if (!input) {
            return [];
        }
        if (logger === null) {
            logger = _Loggers__WEBPACK_IMPORTED_MODULE_1__.NullLogger.instance;
        }
        const messages = _TextMessageFormat__WEBPACK_IMPORTED_MODULE_2__.TextMessageFormat.parse(input);
        const hubMessages = [];
        for (const message of messages) {
            const parsedMessage = JSON.parse(message);
            if (typeof parsedMessage.type !== "number") {
                throw new Error("Invalid payload.");
            }
            switch (parsedMessage.type) {
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Invocation:
                    this._isInvocationMessage(parsedMessage);
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.StreamItem:
                    this._isStreamItemMessage(parsedMessage);
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Completion:
                    this._isCompletionMessage(parsedMessage);
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Ping:
                    break;
                case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__.MessageType.Close:
                    break;
                default:
                    logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_4__.LogLevel.Information, "Unknown message type '" + parsedMessage.type + "' ignored.");
                    continue;
            }
            hubMessages.push(parsedMessage);
        }
        return hubMessages;
    }
parseMessages ( input , logger ) { if ( typeof input !== "string" ) { throw new Error ( "Invalid input for JSON hub protocol. Expected a string." ) ; } if ( ! input ) { return [ ] ; } if ( logger === null ) { logger = _Loggers__WEBPACK_IMPORTED_MODULE_1__ . NullLogger . instance ; } const messages = _TextMessageFormat__WEBPACK_IMPORTED_MODULE_2__ . TextMessageFormat . parse ( input ) ; const hubMessages = [ ] ; for ( const message of messages ) { const parsedMessage = JSON . parse ( message ) ; if ( typeof parsedMessage . type !== "number" ) { throw new Error ( "Invalid payload." ) ; } switch ( parsedMessage . type ) { case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__ . MessageType . Invocation : this . _isInvocationMessage ( parsedMessage ) ; break ; case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__ . MessageType . StreamItem : this . _isStreamItemMessage ( parsedMessage ) ; break ; case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__ . MessageType . Completion : this . _isCompletionMessage ( parsedMessage ) ; break ; case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__ . MessageType . Ping : break ; case _IHubProtocol__WEBPACK_IMPORTED_MODULE_3__ . MessageType . Close : break ; default : logger . log ( _ILogger__WEBPACK_IMPORTED_MODULE_4__ . LogLevel . Information , "Unknown message type '" + parsedMessage . type + "' ignored." ) ; continue ; } hubMessages . push ( parsedMessage ) ; } return hubMessages ; }
Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.
Creates an array of { @link @microsoft / signalr . HubMessage } objects from the specified serialized representation .
// The interface does allow "ArrayBuffer" to be passed in, but this implementation does not. So let's throw a useful error. // Parse the messages // Single value, no need to validate // All optional values, no need to validate // Future protocol changes can add message types, old clients can ignore them