Skip to content

feat(wish/cpp): split TLS implementation from the example server/client#19

Open
tyoshino wants to merge 2 commits intomainfrom
takeshi/transport
Open

feat(wish/cpp): split TLS implementation from the example server/client#19
tyoshino wants to merge 2 commits intomainfrom
takeshi/transport

Conversation

@tyoshino
Copy link
Collaborator

@tyoshino tyoshino commented Mar 2, 2026

No description provided.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to clarify that this is an echo server implementation


// Echo back
if (opcode == WISH_OPCODE_TEXT)
handler->SendText(msg);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to not prefixing received data with "Echo: "

else if (opcode == WISH_OPCODE_BINARY)
handler->SendBinary(msg);
else if (opcode == WISH_OPCODE_TEXT_METADATA)
handler->SendTextMetadata(msg);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to echo back using the same opcode respectively

Comment on lines +29 to +43
std::string ca_file_;
std::string cert_file_;
std::string key_file_;

std::string host_;
int port_;

TlsContext tls_ctx_;
struct event_base* base_;
struct evdns_base* dns_base_;

WishHandler* handler_;

OpenCallback on_open_;
MessageCallback on_message_;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grouped variables for each layer

return SendMessage(WISH_OPCODE_BINARY, msg);
}

int WishHandler::SendMetadata(bool is_text, const std::string& msg) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to simply have dedicated methods for each of binary and text

Comment on lines +18 to +21
const uint8_t WISH_OPCODE_TEXT = 1;
const uint8_t WISH_OPCODE_BINARY = 2;
const uint8_t WISH_OPCODE_TEXT_METADATA = 3;
const uint8_t WISH_OPCODE_BINARY_METADATA = 4;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defined consts for the opcodes

Comment on lines -58 to -62
add_executable(wish-server examples/server.cc)
target_link_libraries(wish-server wish_handler)
add_executable(echo_server examples/echo_server.cc)
target_link_libraries(echo_server wish_handler)

add_executable(wish-client examples/client.cc)
target_link_libraries(wish-client wish_handler)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing the wish- prefix for now for simplicity

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding a very simple base for benchmarking

@tyoshino tyoshino marked this pull request as ready for review March 2, 2026 14:29
const uint8_t WISH_OPCODE_TEXT_METADATA = 3;
const uint8_t WISH_OPCODE_BINARY_METADATA = 4;

// WishHandler implements the WiSH Procotol defined at https://datatracker.ietf.org/doc/html/draft-yoshino-wish
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding this so that agents see it

@tyoshino tyoshino requested a review from wenbozhu March 2, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant