Edit: I'm no longer trying to do this. Now I just use the surrealdb rust client with the protocol-ws feature flag.
I'm connecting to surreal db's /sql
endpoint with a websocket.
The http docs say to NS
and DB
http headers, but my WebSocket library doesn't seem to support this.
I'd like to just send a USE statement but it seems to get ignored.
It returns the reply: [{"time":"7.383µs","status":"OK","result":null}]
Then as soon as I try a select statement I get: [{"time":"13.028µs","status":"ERR","detail":"Specify a namespace to use"}]
Surreal logs show its executing both statements:
[2022-10-10 00:12:21] INFO surreal::web 127.0.0.1:46148 GET /sql HTTP/1.1 101 "-" 47.774µs
[2022-10-10 00:12:21] DEBUG surrealdb::dbs Executing: USE NS webapp DB webapp
[2022-10-10 00:12:21] DEBUG surrealdb::dbs Executing: SELECT * FROM user