surrealdb / surrealdb.py

SurrealDB SDK for Python
https://surrealdb.com
Apache License 2.0
170 stars 49 forks source link

Increasing the size of the WebSocket #70

Open ViniciusLucchesi opened 10 months ago

ViniciusLucchesi commented 10 months ago

What is the motivation?

WebSocket only handles 1MB of data and I'm getting this error message sent 1009 (message too large); no closed frames received when I try to do a SELECT * FROM my_table when my_table had more than 1 MB of data.

Type of Change

What does this change do?

These changes allow the user to specify what is the max size of the data that the WebSocket connection to the SurrealDB will be capable to handle.

What is your testing strategy?

import asyncio
from surrealdb import Surreal

DB = Surreal()

async def main():
    await DB.connect("ws://localhost:8000/rpc", max_size=3000000)
    await DB.signin({"user": "root", "pass": "root"})
    await DB.use(database="test", namespace="test")

    try:
        data = await DB.select("tipi")
    except Exception as e:
        data = str(e) 
    print(data)

if __name__ == '__main__':
    asyncio.run(main())

This script will print on the terminal all data from your table, but if you remove the max_size parameter from connect method the max size handle will be only 1 MB as default.

Is this related to any issues?

No

Have you read the Contributing Guidelines?

meppu commented 10 months ago

Hi,

I noticed that the latest commit appears to be unrelated to the feedback I provided in my previous review. Please let me know if you have any questions about the feedback I provided or if you'd like any clarification on specific points.

I want to clarify that I don't have merge access and my initial review was offered from a personal standpoint to provide insights and suggestions.