mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
mutation proof of concept
client can now send mutations and server properly executes them TODO: implement query execution, add auth, add storage
This commit is contained in:
+15
-2
@@ -1,8 +1,21 @@
|
||||
import { TetherClient } from "tether-ts";
|
||||
import { createInterface } from "node:readline/promises";
|
||||
|
||||
const client = new TetherClient();
|
||||
client.connect("ws://localhost:8080/tether");
|
||||
|
||||
client.subscribe("messages", (message) => {
|
||||
client.subscribe("messages", { room: "1" }, (message) => {
|
||||
console.log("Received message", message);
|
||||
});
|
||||
});
|
||||
|
||||
const rl = createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
while (true) {
|
||||
const message = await rl.question("Enter a message");
|
||||
if (message) {
|
||||
client.sendMutation("createMessage", { room: "1", message: message });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user