Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLIENT & SERVER CANNOT CONNECT# client use sockeito, which EIO=3, server use python-socketio==4.6.1 #1224

Closed
qiangziakbar opened this issue Aug 6, 2023 Discussed in #1223 · 3 comments

Comments

@qiangziakbar
Copy link

Discussed in #1223

Originally posted by qiangziakbar August 6, 2023
from error below, I could tell that client EIO=3,

INFO:     ('127.0.0.1', 47094) - "WebSocket /socket.io/?EIO=3&transport=websocket" 403
INFO:     connection failed (403 Forbidden)
INFO:     connection closed

my server using 4.6.1, server code is like this, why my server doesnt work? it works well in websocket, but I think socketio will be better, but for now, it cannot build connection

import uvicorn
from fastapi import FastAPI
from fastapi.responses import HTMLResponse

import socketio

sio_client = socketio.AsyncClient()

sio_server = socketio.AsyncServer(
    async_mode='asgi',
    cors_allowed_origins="*"
    )
sio_app = socketio.ASGIApp(
    socketio_server = sio_server,
)

app = FastAPI()
app.mount('/ws',app=sio_app)

@sio_server.on("test")
async def my_message(sid, data):
    print('test message is : ', data)
    await sio_server.emit("servermessage",f"test {data}")

@sio_server.on("clientmessage")
async def client_message(sid, data):
    print('clientmessage is : ', data)
    await sio_server.emit("servermessage",f"client sent {data}")

if __name__ == "__main__":
    uvicorn.run("socket_main:app",reload=True,port=8000)
```</div>
@qiangziakbar
Copy link
Author

my engineio version is as below

root@VM-12-17-ubuntu:/home/ubuntu# pip show python-engineio
Name: python-engineio
Version: 3.14.2
Summary: Engine.IO server
Home-page: http://github.com/miguelgrinberg/python-engineio/
Author: Miguel Grinberg
Author-email: miguelgrinberg50@gmail.com
License: MIT
Location: /usr/local/lib/python3.10/dist-packages
Requires: six
Required-by: python-socketio
root@VM-12-17-ubuntu:/home/ubuntu# 

@miguelgrinberg
Copy link
Owner

Please don't write issues when you just need help with your project. Thank you.

@miguelgrinberg miguelgrinberg closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
@qiangziakbar
Copy link
Author

Thank you for your help, next time I will seek help in discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants