mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
initial commit
This commit is contained in:
30
examples/chat_server/chat.cpp
Normal file
30
examples/chat_server/chat.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "chat.hpp"
|
||||
|
||||
using websocketchat::chat_handler;
|
||||
|
||||
|
||||
bool chat_handler::validate(websocketpp::session_ptr client) {
|
||||
// We only know about the chat resource
|
||||
if (client->get_request() != "/chat") {
|
||||
client->set_http_error(404);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Require specific origin example
|
||||
if (client->get_header("Sec-WebSocket-Origin") != "http://zaphoyd.com") {
|
||||
client->set_http_error(403);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void connect(session_ptr client) {
|
||||
std::cout << "client " << client << " joined the lobby." << std::endl;
|
||||
m_connections.insert(client);
|
||||
|
||||
// send user list to all clients
|
||||
// send signon message from server to all other clients.
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user