Live data (websocket via) python to Matlab

I need to subscribe to a websocket feed to receive live data into Matlab although Matlab has no built in function for this so a python function can be called from Matlab but I’m stuck at how to make this happen continuously as using a return statement ends the function and calling it again kind of defeats the purpose of websocket.

I could probably do something where I write the feed to a database and then query it from Matlab but I’m not sure if this is optimal.

Would appreciate advice on how to go about this or if the database approach makes most sense.