forked from Query-farm/radio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathradio-test.sql
More file actions
95 lines (56 loc) · 2.65 KB
/
Copy pathradio-test.sql
File metadata and controls
95 lines (56 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
-- Open a connection to a websocket server
CALL radio_subscribe('ws://127.0.0.1:20400');
.mode line
-- Show all subscriptions.
select * from radio_subscriptions();
-- Show all messages received so far.
select * from radio_received_messages();
.mode duckbox
-- Block until a message is received for 10 seconds.
CALL radio_listen(true, interval '10 seconds');
-- Show all messages received so far.
.mode line
select * from radio_received_messages();
-- Show the messages
select message_id, message, receive_time from radio_received_messages()
order by receive_time;
-- Sleep 10 seconds to accumulate messages.
CALL radio_sleep(interval '1 seconds');
-- Show the message
select message_id, message, receive_time from radio_received_messages()
order by receive_time;
.mode line
-- Show all subscriptions.
select * from radio_subscriptions();
.mode duckbox
CALL radio_transmit_message('ws://127.0.0.1:20400', null, 'TEST MESSAGE'::blob, 10, interval '1 minute');
.mode line
SELECT * FROM radio_subscription_transmit_messages('ws://127.0.0.1:20400');
.mode line
SELECT * FROM radio_subscription_received_messages('ws://127.0.0.1:20400');
.mode line
SELECT * FROM radio_subscription_transmit_messages('ws://127.0.0.1:20400');
.mode duckbox
CALL radio_transmit_message('ws://127.0.0.1:20400', null, 'TEST MESSAGE2'::blob, 1, interval '10 seconds');
.mode line
SELECT * FROM radio_subscription_transmit_messages('ws://127.0.0.1:20400');
CALL radio_subscription_transmit_messages_delete_finished('ws://127.0.0.1:20400');
.mode line
SELECT * FROM radio_subscription_transmit_messages('ws://127.0.0.1:20400');
CALL radio_transmit_message('ws://127.0.0.1:20400', null, 'test message 3'::blob, 1, interval '10 seconds');
SELECT * FROM radio_subscription_transmit_messages('ws://127.0.0.1:20400');
CALL radio_subscription_transmit_message_delete('ws://127.0.0.1:20400', 1003::ubigint);
SELECT * FROM radio_subscription_transmit_messages('ws://127.0.0.1:20400');
.mode duckbox
SELECT * from radio_flush(interval '10 seconds');
CALL radio_unsubscribe('ws://127.0.0.1:20400');
CALL radio_subscribe('redis-tcp://127.0.0.1:6379?channel=radio_test&socket_timeout=100ms');
select * from radio_subscriptions();
.mode duckbox
SELECT * FROM radio_subscription_transmit_messages('redis-tcp://127.0.0.1:6379?channel=radio_test&socket_timeout=100ms');
-- Block until a message is received for 10 seconds.
CALL radio_listen(true, interval '10 seconds');
select * from radio_received_messages();
CALL radio_sleep(interval '4 seconds');
select * from radio_received_messages();
CALL radio_subscription_transmit_messages_delete_finished('redis-tcp://127.0.0.1:6379?channel=radio_test&socket_timeout=100ms');