Ogadai / zwift-mobile-api

MIT License
120 stars 25 forks source link

Workout / Interval messages #27

Open johnpoole opened 5 years ago

johnpoole commented 5 years ago

Is there anything representing workouts in the api? It seems like there are a few undefined messages in zwiftMessages.proto. If the power/time/cadence of each interval was in there it would allow for some integration with the workouts and music, lights, etc.

Is there a way to log the entire buffer while doing a workout to track down whether that info is there?

wiedmann commented 5 years ago

The easiest way to do this is to use Wireshark or an equivalent packet sniffer. Wireshark has the ability to save out the data stream and there is a plugin that handles protobuf decoding. You can use the .proto file from this project as a starting point.

Having said that, I think it's unlikely that interval data would be sent back to the server. I don't see any reason why they would do that since it's not shared with anyone else. Zwift does most of the heavy lifting on the client side. The server is mostly just routing traffic to make riders visible to each other.

johnpoole commented 5 years ago

Thanks. I did set up wireshark and was looking for data being sent from the Zwift client to the companion app. Are the messages only between the server and the client apps?

wiedmann commented 5 years ago

Oh I see. The companion app messages are sent over a separate TCP connection that’s initiated from the game to the app. You should be able to find those as well, but they’re encoded slightly differently since they’re transmitted in a stream. Look for the length-prefixed protobuf dissector for Wireshark.

You’re right that there are many messages between app and game that have not yet been reverse engineered so you may find what you’re looking for there.

johnpoole commented 5 years ago

Thanks for the info. I'll post anything useful I find.