Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom format for request and response with or without @class #225

Open
enflout opened this issue Mar 26, 2015 · 0 comments
Open

Custom format for request and response with or without @class #225

enflout opened this issue Mar 26, 2015 · 0 comments

Comments

@enflout
Copy link

enflout commented Mar 26, 2015

When I send request it looks like (Google Chrome Console) :

42/v1/user,["currentPerson",{"transactionId":"53445t-53454-534543-53453435"}]

where 53445t-53454-534543-53453435 - is unique transactionId which I automatically include in request and each response.

The response looks like

42/v1/user,["currentPerson","53445t-53454-534543-53453435",{"id":5,"firstName":"Ivan"}]

where /v1/user - namespace with versioning;

  1. What is the 42?
  2. I want such kind of response
{
    "transactionId": "53445t-53454-534543-53453435",
    "namespace": "/v1/user",
    "event": "currentPerson",
    "person": {
        "id": 5,
        "firstName": "Ivan"
    }
}
  1. And such kind of request
{
    "transactionId": "53445t-53454-534543-53453435",
    "namespace": "/v1/user",
    "event": "currentPerson"
}

Now I use socket-io js client but only for test purposes, service will be used with using some C++ library, so I need to use not the socket.io style format.

Is it possible? What methods can I use?

I have found addJsonObjectListener method and sendJsonObject, but I also don't want to pass a @Class directive, it seems weird to me to give client a knowledge about server class hierarchy (package prefix is okay). I just want define some object on the client and parse it manually on the server, then pass manually formed json to the client.

P.S.: By the way Configuration.jsonTypeFieldName is not available now, so @Class now is the only option of name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant