Hello everyone, i'm trying to make a python websocket using websockets library also flask
so basically i have this ->
functions functions etc....
when i go to my website hhr-bot-api.xyz i get the empty flask page but the thing is how do i connect to the websocket server? the railway terminal doesn't show anything out of common i used everything.
wss://hhr-bot-api.xyz:4505
/
....... nothing looks to work.15 Replies
Project ID:
fe5eb4db-8d92-4c45-b324-2d7bdeba2691
you can't expose multiple ports, you need to have the websocket and http server listening on a single port
okay i'll try this one. Thanks
doesn't work either
what doesn't work
connecting to the websocket
the flask app works perfectly
then that would be a code issue
that's an issue too
Pastebin
import loggingimport flask;from flask import Flask, render_template...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
look by yourself ....
unfortunately I'm not a python developer, so I'm not much help here, but I know for an absolute fact that this can be done
oh
ty anyway then.
some things that might help,
you may consider using quart instead of flask: https://flask.palletsprojects.com/en/2.3.x/async-await/#when-to-use-quart-instead
i connect to my websocket like this (no port)
and it seems to be working, but im still in testing phases. a fetch interrupts this connection & that may be a problem with my code. in quart you can define a websocket route like this
thanks, works now.