Skip to content

Setting JSON encoded data on to a websocket_outgoing_message  #304

@abuneri

Description

@abuneri

So the websocket gateway I am connecting to sends and receives data in JSON encoding. Right now when I receive the data it just comes in string format, which is fine to parse. However, with the websocket_outgoing_message class you can only set the outgoing payload to be binary or utf8 encoding, and for utf-8 excepts a std::string argument. I can't simply just build up a json object with web::json and send it in as an argument with as_string() because the object(s) I need to send have strings, booleans, ints, and nested objects alike.

So my question is, should I be able to just pass in a std::string in JSON format, given that on the receiving end it takes the JSON and spits out a std::string? Or is this client library simply only able to send simple strings to the websocket server. I've been trying a couple things, but I thought I'd ask here just in case it isn't possible. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions