hi Jirapongse
I asked a question in the past "[OMMSTREAMING_PRICING_0.12] received a closing message (cxn state=StreamCxnState.Connected, message state={'Stream': 'Closed', 'Data': 'Suspect', 'Code': 'UserAccessToAppDenied', 'Text': 'TREP authentication failed (1026, Request for token validatio"
Jirapongse sent me an answer, I flowed his tip and some other tips from Refinitiv so I can reproduce scenario when I use two separate clients with same connection key (Refinitiv authorization key on configuration) the second client grabs the connection,
first client shows on console the error message:
[Error 400 - invalid_grant] empty error description
later after expiration period pass, first launched client closes with this message
[OMMSTREAMING_PRICING_0.21] received a closing message (cxn state=StreamCxnState.Connected,....
I have edited the Rfinitiv connector code to add messages and try understand how to bubble up this closing connection messages
on omm_stream_connection.py::_handle_login_message and on _process_message
[Error 400 - invalid_grant] empty error description
and after a minute my tweak shows:
[Refinitive ## FIXME: ori kovacsi ##] From Refinitiv OMM STREAM session Status state!!! [Refinitive ## FIXME: ori kovacsi ##] From Refinitiv OMM STREAM session Closed atate!!! [OMMSTREAMING_PRICING_0.21] received a closing message (cxn state=StreamCxnState.Connected,....
so the code handles this case. how can I subscribe to any _on_ws_message so it will be sent to some call back on my top level application ?
Or better - alternatively how can I prevent second connection from grabbing the key from the first websocket connection in the first place. Is there a configuration that prevent new connections from getting the key so first will continue forever?
Thanks For advance
Ori
edited:
digging into the source code I can see at
C:\Users\<user name>\.conda\envs\<python environment name>\Lib\site-packages\refinitiv\data\_data\log.py
def _create_log_stdout_handler():
handler_ = logging.StreamHandler(sys.stdout)
handler_.setFormatter(_stdout_formatter)
return handler_
can I redirect log messages to bubble up to my Application instead of printing to console stdout?
I think the flow of failure message is stopped in this function and this is the reason I can't catch the case of loosing expiration token validity in a programmatic manner.
If I could bind a call-back handler on my application it can help me to create a workaround to this issue.
EDITED:
I keep digging and enforcing the connection stability
while checking the connector code I stumbled across this assignment
self._grant: "GrantPassword" = self._session._grant
on class RefreshTokenUpdater(Updater, LogReporter): in file
C:\Users\<User Name>\.conda\envs\<python env name>\Lib\site-packages\refinitiv\data\_data\core\session\refresh_token_updater.py
It is first time I see ":" notation on assignment / initialization of class property/parameter. What does this notation do?