KradekMFC / ModelsOnline

List models currently online on MFC
0 stars 0 forks source link

Change in MFC protocol? #3

Closed jackpryan closed 8 years ago

jackpryan commented 8 years ago

Hi,

Thanks for some great sources and ideas on communicating with MFC WebSockets.

This isn't an issue related directly to your code, but rather MFC:s "protocol", are you aware if they have changed it recently?

I've written my own implementation and when I connect and start receiving messages, I don't get the same order as the order in your method MFCMessage.AsSocketMsg()

You've coded: [MessageType] [From] [To] [Arg1] [Arg2] [Data]

I get the following from MFC, when doing a MFCMessage.UserLookupMessage(model) without logging on, of an offline model:

010610 5223937 281470899 20 0 {"sid":0,"uid":5223937,"nm":"LanaIvans","lv":4,"vs":127}

I'm not entirely sure how to parse the order of these parameters. The only one which I'm a little sure of, is the 3rd parameter, which seems to be (281470899) SessionID (to). Last part is of course the JSON payload.

Any help appreciated!

KradekMFC commented 8 years ago

010610 5223937 281470899 20 0 {"sid":0,"uid":5223937,"nm":"LanaIvans","lv":4,"vs":127}

For a raw message, he first 4 characters is the length of the message. The next two is the message type.

So for the message above, you have a message that is 106 characters long with a message type of 10 (which is FCTYPE_USERNAMELOOKUP). What the next five parameters are varies based on the type of the message. In this case, From is the model’s id, the To is, I believe, the user’s session id, and I don’t quite remember what the next two mean for that message type. The Data parameter as you surmised is just the JSON payload.

Looks like a normal message following the protocol to me. I would be surprised if they change that anytime soon, but I haven’t been following it closely.

From: Jack P. Ryan [mailto:notifications@github.com] Sent: Saturday, January 9, 2016 4:56 PM To: KradekMFC/ModelsOnline ModelsOnline@noreply.github.com Subject: [ModelsOnline] Change in MFC protocol? (#3)

Hi,

Thanks for some great sources and ideas on communicating with MFC WebSockets

This isn't an issue related directly to your code, but rather MFC:s "protocol", are you aware if they have changed it recently?

I've written my own implementation and when I connect and start receiving messages, I don't get the same order as the order in your method MFCMessageAsSocketMsg()

You've coded: [MessageType] [From] [To] [Arg1] [Arg2] [Data]

I get the following from MFC, when doing a MFCMessageUserLookupMessage(model) without logging on, of an offline model:

010610 5223937 281470899 20 0 {"sid":0,"uid":5223937,"nm":"LanaIvans","lv":4,"vs":127}

I'm not entirely sure how to parse the order of these parameters The only one which I'm a little sure of, is the 3rd parameter, which seems to be (281470899) SessionID (to) Last part is of course the JSON payload

Any help appreciated!

— Reply to this email directly or view it on GitHub https://github.com/KradekMFC/ModelsOnline/issues/3 . https://github.com/notifications/beacon/ADTgu08ZCx22K2URd0i9NKdFbYDdAfiyks5pYXlWgaJpZM4HBxLB.gif

KradekMFC commented 8 years ago

The ModelsOnline code is pretty old; a better understanding of what’s going on is in MFCSocket, though that’s JavaScript of course. I switched from .net to node.js for my personal projects.

From: Jack P. Ryan [mailto:notifications@github.com] Sent: Saturday, January 9, 2016 4:56 PM To: KradekMFC/ModelsOnline ModelsOnline@noreply.github.com Subject: [ModelsOnline] Change in MFC protocol? (#3)

Hi,

Thanks for some great sources and ideas on communicating with MFC WebSockets

This isn't an issue related directly to your code, but rather MFC:s "protocol", are you aware if they have changed it recently?

I've written my own implementation and when I connect and start receiving messages, I don't get the same order as the order in your method MFCMessageAsSocketMsg()

You've coded: [MessageType] [From] [To] [Arg1] [Arg2] [Data]

I get the following from MFC, when doing a MFCMessageUserLookupMessage(model) without logging on, of an offline model:

010610 5223937 281470899 20 0 {"sid":0,"uid":5223937,"nm":"LanaIvans","lv":4,"vs":127}

I'm not entirely sure how to parse the order of these parameters The only one which I'm a little sure of, is the 3rd parameter, which seems to be (281470899) SessionID (to) Last part is of course the JSON payload

Any help appreciated!

— Reply to this email directly or view it on GitHub https://github.com/KradekMFC/ModelsOnline/issues/3 . https://github.com/notifications/beacon/ADTgu08ZCx22K2URd0i9NKdFbYDdAfiyks5pYXlWgaJpZM4HBxLB.gif

jackpryan commented 8 years ago

010610 5223937 281470899 20 0 {"sid":0,"uid":5223937,"nm":"LanaIvans","lv":4,"vs":127}

For a raw message, the first 4 characters is the length of the message. The next two is the message > type.

Thanks! I don't know how I missed that I was dealing with a raw message! :+1: