本文整理汇总了C++中QWebSocket::sendBinaryMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebSocket::sendBinaryMessage方法的具体用法?C++ QWebSocket::sendBinaryMessage怎么用?C++ QWebSocket::sendBinaryMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebSocket
的用法示例。
在下文中一共展示了QWebSocket::sendBinaryMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processBinaryMessage
void wsServer::processBinaryMessage(QByteArray message)
{
QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
if (pClient) {
pClient->sendBinaryMessage(message);
}
}
示例2: processBinaryMessage
void Server::processBinaryMessage(QByteArray message)
{
QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
if (m_debug)
qDebug() << "Binary Message received:" << message;
if (pClient) {
pClient->sendBinaryMessage(message);
}
}
示例3: onNewConnection
void OpenGLServer::onNewConnection()
{
QWebSocket *pSocket = mpWebSocketServer->nextPendingConnection();
connect(pSocket, &QWebSocket::binaryMessageReceived, this, &OpenGLServer::processBinaryMessage);
connect(pSocket, &QWebSocket::disconnected, this, &OpenGLServer::socketDisconnected);
connect(&trace::localWriter, &trace::LocalWriter::frameEnd, this, &OpenGLServer::onFrameEnd);
mClients << qMakePair(pSocket, false);
pSocket->sendBinaryMessage(trace::localWriter.getInitFrame());
}
示例4: write
// _____________________________________________________________________
void CWebSocketServer::write(int client_id, QByteArray data)
{
//qDebug() << "CWebSocketServer::write" << client_id << data;
QWebSocket *pClient = NULL;
if (m_clients_rev.contains(client_id)) {
pClient = m_clients_rev[client_id];
}
if (pClient) {
if (m_transmission_mode == BINARY_MODE) pClient->sendBinaryMessage(data);
else pClient->sendTextMessage(data);
emit bytesWritten(client_id, data.size());
}
}