Don't create more than one connection using the same state/device! This will lead you to unexpected behaviour when the previous connection from the same device is being dropped by instagram server. Instagram server doesn't tell the reason, it just drops the connection without explanations, so IGPAPI is not able to tell you what is going wrong. That's why you should pay close attention to this aspect while developing your systems. Moreover, IGPAPI have built-in auto-reconnect mechanism, so if you run 2 IGPAPI realtime connections simultaneously, you will end up in endless reconnection loop on both of these connections that will lead you to losing realtime events in reconnection gaps.
This package contains the base client to handle realtime events on both web and Android. It appears both platforms talk to the same realtime interface/server (but with a different connect/auth process).
The IgpapiRealtime
is the abstract class both implementations inherit from.
It's main purpose is to handle and decode packets as well as manage the underlying mqtt client (e.g. reconnecting).
It provides helper functions to simplify sending and receiving:
preparePayload
Converts and encodes any data appropriatelyencode-
and decodeTopic
map topic ids to their appropriate namespublishToMqtt
, request
and mqttSubscribe
unify the publishing/subscribingIt provides user facing methods/properties:
connect
irisSubscribe
, graphQlSub
, graphQlUnsub
, skywalkerSub
and skywalkerUnsub
simplify the subscription to eventsdirectCommands
encodes direct messagesIt provides implementation specific abstract methods:
createMqttClient
creates a transport/client for mqtt packetsconnectToBroker
connects the transport/clientpostConnect
is called after the connection succeeded in order to perform platform specific tasksIt provides an interface for mixins.
In order to find events or validate existing logic, you have two options:
Test the client with debug logging enabled (highly recommended even if not testing). This can be done by simply interacting with the logged in account and logging messages.
Reverse engineer existing logic. This is platform specific.
For more information, look in the android realtime
and web realtime
packages respectively.
This a short summary:
/DirectMqtt.js/
. The debugger probably has a button to pretty print the minified code.
__d(function (...) {})
is just an export.android realtime
).
But you may also want to look through the code.
You can use a decompiler for apks and search for important strings.
This is the easiest method of finding the code responsible for a feature.
Personally, I'd recommend GDA on Windows as it can search for Cross References (X
),
which is a huge timesaver.