Skip to content

Feature Request : Expose sio::message mapping to/from std::string #87

Open
@jhamell

Description

@jhamell

Hello,

Apologies if this is already available or out of scope, but would it be possible to configure this library to expose the necessary functions to map between sio::message and JSON strings?

Our use case might not be very common, but we are currently loading a socket.io client through Lisp's CFFI, and there is a lot of infrastructure to build to map between the domains (most everything needs reduced to C functions and structs). We're working against a moving target on the server side API, so each minor change cascades into numerous C/C++ modifications.

Ideally, this would be convenient:
sio::message sio::message::create_from_json( const std::string& payload )
std::string sio::message::to_json()

If the string mappings were possible, I could modify our C wrapper to accept something of the sort:

char* emit_with_response( char* messageName, char* jsonPayload )

The Lisp caller can deal with the malloc/free of the strings, and can use existing facilities (cl-json) to pull the raw json strings into json object representations. Our wrapping could manage those into std::string and use the packet/whatever utlities to eventually call emit( messageName, createdPayloadFromString ),

Thanks,
Josh

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