aisstream / issues

7 stars 3 forks source link

Doubt with Python example #3

Closed berbaba closed 1 year ago

berbaba commented 1 year ago

This is more a doubt than an issue, so if it's not appropriate I'm ok with this being closed/deleted. I'm new to the websockets library so I'm not sure if the line has a mistake (that works the same as far as I can tell with or without this) or it's intended: if __name__ == "__main__": asyncio.run(asyncio.run(connect_ais_stream())) Is the nested asyncio.run(asyncio.run(...)) on purpose for some reason or a harmless mistake? I wouldn't mind it (as it doesn't seem to change the performance) but I'm trying to get the program to working continuously and fix an issue that seems to be related to with the connection closing (that happens independently of the nesting and I'm going to write a different issue for it). Thank you!

aisstream commented 1 year ago

Hello, you are likely correct that the nested functions are not required, not sure how that snuck in there.

We admittedly do not have a string background in async python (aisstream.io is written in go, rust and some c) so it is very likely our code is not the pythonic way of doing things or has some unnecessary functions.

aisstream commented 1 year ago

I will create a pull request to remove this in the coming days.

aisstream commented 1 year ago

Tested solution and docs updated