本文整理匯總了TypeScript中websocket.connection.sendBytes方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript connection.sendBytes方法的具體用法?TypeScript connection.sendBytes怎麽用?TypeScript connection.sendBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類websocket.connection
的用法示例。
在下文中一共展示了connection.sendBytes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
return this.conn.then((connection: WebSocketConnection) => {
// Send the request to the stream platform gateway
connection.sendBytes(this.protocolHandler.encode(request));
// Register our response handler
return this.registerResponseHandler(connection, request).then((response: ServiceResponse ) => {
// Remove this response handler
this.removeResponseHandler(request);
return response;
});
});
示例2: ResolveServiceRequest
return this.conn.then((connection: WebSocketConnection) : P<ServiceProxy> => {
let request : ServiceRequest = new ResolveServiceRequest(query);
// Send the request to the stream platform gateway
connection.sendBytes(this.protocolHandler.encode(request));
// Register our response handler
return this.registerResponseHandler(connection, request).then((response: ServiceResponse ) : ServiceProxy => {
console.log("Received response", response);
// Remove this response handler
this.removeResponseHandler(request);
// Create our service proxy
return new StreamServiceProxy(this, connection, response.data);
});
});