pusher / pusher-websocket-dotnet

Pusher Channels Client Library for .NET
MIT License
111 stars 113 forks source link

Update from 1.2 to 2.1 changed JSON structure #115

Closed SmileSoftSr closed 2 years ago

SmileSoftSr commented 3 years ago

I've updated the libraries in one of my Pusher projects (1.2 to 2.1) via NuGet Package manager in VS 2015, and all of a sudden, my JSON parsing is not working anymore. After checking why, it seems that the structure of the received JSON was changed.

Instead of this:

{
    "event": "myevent",
    "data": {
        "message": {
            "header": {
                "type": "type1",
                "printer": "myprinter"
            },
            "items": {
                "1": "Item 1@03@Kg@1@1782.00@1782.00@6002@03"
            },
            "info": {
                "type": "stuff",
                "other": "yes"
            }
        }
    },
    "channel": "mychannel"
}

the JSON now looks like this

{
    event = cashregister,
    data = {
        "message": {
            "header": {
                "type":"type1",
                "printer":"myprinter"
            },
            "items": {
                "1":"Item 1@03@Kg@1@1782.00@1782.00@6002@03"
            },
            "info": {
                "type":"stuff",
                "other":"yes"
            }
        }
    },
    channel = mychannel,
    user_id =  
}

Short of downgrading back to 1.2, how can I get the JSON structure I had before? Please note that nothing was changed on the sending end - the JSON structure is the same as before the upgrade.

elverkilde commented 2 years ago

The structure you are referring to seems to be in the opaque payload for the internals of the SDK. The user of the SDK would normally only interact with what's inside the data field, which in this case seems to be the same.

Which method/callback in the SDK are you using to get the raw JSON payload?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you'd like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you.