当前位置: 首页>>代码示例>>C++>>正文


C++ QWebSocket类代码示例

本文整理汇总了C++中QWebSocket的典型用法代码示例。如果您正苦于以下问题:C++ QWebSocket类的具体用法?C++ QWebSocket怎么用?C++ QWebSocket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QWebSocket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processBinaryMessage

void wsServer::processBinaryMessage(QByteArray message)
{
   QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
   if (pClient) {
       pClient->sendBinaryMessage(message);
   }
}
开发者ID:kuroyuki,项目名称:cmdNodes,代码行数:7,代码来源:wsserver.cpp

示例2: onDisconnected

 void onDisconnected() {
     JOYNR_LOG_TRACE(logger, "on disconnected");
     QWebSocket* client = qobject_cast<QWebSocket*>(sender());
     if(client) {
         client->deleteLater();
     }
 }
开发者ID:icyerasor,项目名称:joynr,代码行数:7,代码来源:WebSocketMessagingStubTest.cpp

示例3: socketDisconnected

// remove the client from when it disconneced
void ServerDeamon::socketDisconnected() {
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
	if (pClient) {
        m_clients.removeAll(pClient);
        pClient->deleteLater();
    }
}
开发者ID:Adrenocrom,项目名称:muskat,代码行数:8,代码来源:deamon.cpp

示例4: connect

void ShtServer::onNewConnection()
{
    QWebSocket *socket = socketServer->nextPendingConnection();
    connect(socket, &QWebSocket::textMessageReceived, this, &ShtServer::onTextMessage);
    connect(socket, &QWebSocket::disconnected, this, &ShtServer::onSocketDisconnected);
    //onlineSockets << socket;
    qWarning() << "Added socket " << socket->peerName() << ":" << socket->peerPort();
}
开发者ID:illogica,项目名称:Sht,代码行数:8,代码来源:shtserver.cpp

示例5: JsonApi

void WebSocketServer::onNewConnection()
{
    QWebSocket *socket = m_pWebSocketServer->nextPendingConnection();
    JsonApi *api = new JsonApi(socket, socket->peerAddress() == QHostAddress::LocalHost);
    connect(socket, &QWebSocket::disconnected, this, &WebSocketServer::socketDisconnected);
    connect(socket, &QWebSocket::textMessageReceived, api, &JsonApi::processMessage);
    m_clients[socket] = api;
}
开发者ID:enna-project,项目名称:Enna-Media-Server,代码行数:8,代码来源:WebSocketServer.cpp

示例6: processTextMessage

//! [processTextMessage]
void SslEchoServer::processTextMessage(QString message)
{
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
    if (pClient)
    {
        pClient->sendTextMessage(message);
    }
}
开发者ID:lollinus,项目名称:qt-5.3-examples,代码行数:9,代码来源:sslechoserver.cpp

示例7: socketDisconnected

void ReverseHashDServer::socketDisconnected() {
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());

    std::cout << "socketDisconnected:" << pClient << "\n";
    if (pClient) {
        m_clients.removeAll(pClient);
        pClient->deleteLater();
    }
}
开发者ID:sea-kg,项目名称:reversehash,代码行数:9,代码来源:reversehashd_server.cpp

示例8: socketDisconnected

void WsServer::socketDisconnected()
{
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
    if (pClient) {
        m_clients.removeAll(pClient);
        emit newConnection(m_clients.count());
        pClient->deleteLater();
	}
}
开发者ID:tarmoj,项目名称:waiting-game,代码行数:9,代码来源:wsserver.cpp

示例9: processTextMessage

void EchoServer::processTextMessage(QString message)
{
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
    //if (m_debug)
        qDebug() << "Message received:" << message;
    if (pClient) {
        pClient->sendTextMessage(QString("服务器收到了") + message);
    }
}
开发者ID:yangyang0312,项目名称:C-,代码行数:9,代码来源:echoserver.cpp

示例10: qDebug

//! [processTextMessage]
void BCWebSocketServer::processTextMessage(QString message)
{
    qDebug() << message ;
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
    if (pClient)
    {
        pClient->sendTextMessage(message);
    }
}
开发者ID:abhipr1,项目名称:OpenTradingPlatform,代码行数:10,代码来源:BCWebSocketServer.cpp

示例11: 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);
    }
}
开发者ID:Morindhal,项目名称:nhl,代码行数:9,代码来源:server.cpp

示例12: qDebug

//! [socketDisconnected]
void SslEchoServer::socketDisconnected()
{
    qDebug() << "Client disconnected";
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
    if (pClient)
    {
        m_clients.removeAll(pClient);
        pClient->deleteLater();
    }
}
开发者ID:lollinus,项目名称:qt-5.3-examples,代码行数:11,代码来源:sslechoserver.cpp

示例13: socketDisconnected

void Server::socketDisconnected()
{
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
    if (m_debug)
        qDebug() << "socketDisconnected:" << pClient;
    if (pClient) {
        m_clients.removeAll(pClient);
        pClient->deleteLater();
    }
}
开发者ID:Morindhal,项目名称:nhl,代码行数:10,代码来源:server.cpp

示例14: foreach

// ---------------------------------------------------------------------
WsCln::~WsCln()
{
  QWebSocket* socket;
  foreach (socket, servers) {
#ifdef QT53
    socket->close();
#else
    socket->disconnectFromHost();
#endif
  }
开发者ID:0branch,项目名称:qtide,代码行数:11,代码来源:wscln.cpp

示例15: socketDisconnected

// _____________________________________________________________________
void CWebSocketServer::socketDisconnected()
{
    QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
    if (pClient) {
        int id = m_clients[pClient];
        m_clients.remove(pClient);
        m_clients_rev.remove(id);
        pClient->deleteLater();
    }
}
开发者ID:CRLG,项目名称:LABOTBOX,代码行数:11,代码来源:CWebSocketServer.cpp


注:本文中的QWebSocket类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。