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

Add WebSocket Support #114

Closed
glira opened this issue Aug 28, 2023 · 4 comments · Fixed by #163
Closed

Add WebSocket Support #114

glira opened this issue Aug 28, 2023 · 4 comments · Fixed by #163
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@glira
Copy link

glira commented Aug 28, 2023

you are doing an excellent job congratulations with all my heart you saved part of a business I have here please provide a crypto wallet so I can repay your favor with a donation, I would like to know if it is possible to use websocket.WebSocketApp together with your code

@perklet
Copy link
Collaborator

perklet commented Aug 28, 2023

Thank you for your kind words.

If you are referring to websocket support, it has to be implemented in the upstream project first, see lwthiker/curl-impersonate#157 for more details.

@dolfies
Copy link
Contributor

dolfies commented Sep 15, 2023

Thank you for your kind words.

If you are referring to websocket support, it has to be implemented in the upstream project first, see lwthiker/curl-impersonate#157 for more details.

Hello, looks like upstream support has been added. Any update on this? Love the project btw

@perklet perklet changed the title WebSocketApp Add WebSocket Support Oct 2, 2023
@perklet
Copy link
Collaborator

perklet commented Oct 2, 2023

Preliminary support for websocket can be found here, download and install the wheels. No tests has been added yet, bugs are expected.

import asyncio
from curl_cffi import requests

with requests.Session() as s:
    w = s.connect("ws://localhost:8765")
    w.send(b"Foo")
    reply = w.recv()
    print(reply)
    assert reply == b"Hello Foo!"


async def async_examples():
    async with requests.AsyncSession() as s:
        w = await s.connect("ws://localhost:8765")
        await w.asend(b"Bar")
        reply = await w.arecv()
        print(reply)
        assert reply == b"Hello Bar!"


asyncio.run(async_examples())

@perklet perklet added the enhancement New feature or request label Nov 2, 2023
@perklet perklet added this to the v0.6 milestone Nov 25, 2023
@perklet perklet linked a pull request Dec 11, 2023 that will close this issue
2 tasks
@perklet perklet self-assigned this Dec 11, 2023
@perklet
Copy link
Collaborator

perklet commented Dec 31, 2023

Experimental websockets support has been added since 0.6.0b7, see the examples folder for more details.

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

Successfully merging a pull request may close this issue.

3 participants