Beispiel #1
0
        /// <summary>
        /// Writes a <see cref="GraphQLWebSocketMessageType.Start"/> message to the writer
        /// </summary>
        /// <param name="writer">The writer</param>
        /// <param name="operationId">The operation id of the operation</param>
        /// <param name="request">The operation request containing the payload</param>
        public static void WriteStartOperationMessage(
            this SocketMessageWriter writer,
            string operationId,
            OperationRequest request)
        {
            if (operationId == null)
            {
                throw new ArgumentNullException(nameof(operationId));
            }

            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            writer.WriteStartObject();
            writer.WriteType(GraphQLWebSocketMessageType.Start);
            writer.WriteId(operationId);
            writer.WriteStartPayload();
            writer.Serialize(request);
            writer.WriteEndObject();
        }