-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.corto
More file actions
122 lines (100 loc) · 2.75 KB
/
Copy pathmodel.corto
File metadata and controls
122 lines (100 loc) · 2.75 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
in corto.ws
use corto.httpserver
// Setup new connection (client -> server)
struct connect {
session: string
version: string
}
// Connection established (server -> client)
struct connected {
session: string
}
// Connection failed (server -> client)
struct failed {
version: string
}
// Subscribe for data (client -> server)
struct sub {
id: string
parent: string
expr: string
type: string
offset: uint64
limit: uint64
summary: bool // Do not send content of collections, shorten strings
yield_unknown: bool
}
// Confirm subscription (server -> client)
struct subok {
id: string
}
// Failed to create subscription (server -> client)
struct subfail {
id: string
error: string
}
// Unsubscribe for data (client -> server)
struct unsub {
id: string
}
// Data message (server -> client)
verbatim dataMembers: "text/json"
struct dataObject {
id: string
p: string, optional
s: string, optional
a: string, optional
v: verbatim["text/json"], optional
}
struct dataType {
type: string
kind: string, optional
reference: bool, optional
members: dataMembers, optional
constants: list[string], optional
element_type: string, optional
set: list[dataObject], optional
del: list[dataObject], optional
}
struct data {
sub: string
data: list[dataType], not_null
}
// Delete message (client -> server)
struct delete {
id: string
}
// Update message (client -> server)
struct update {
id: string
v: verbatim["text/json"], optional
}
// WS Server
container service: httpserver.Service, implements:[dispatcher] {
events: map[null, subscriber_event], private|local // Event queue
init() int16
post(event e) void // Post event to event queue
purge(subscriber sub) void // Purge events from queue for a subscriber
flush(subscriber sub) void // Flush pending events for a subscriber
override
on_poll() void // Read events from event queue
on_message(HTTP.Connection c, string msg) void // Receive data
on_close(HTTP.Connection c) void // Connection closed
// Server sessions
table Session {
id: string, key // Session id
// Private members
conn: HTTP.Connection, private|local // HTTP connection
typesAligned: list[type], private|local|not_null // Track types aligned for session
send(object msg) void
// Subscriptions for session
table Subscription: subscriber {
id: string, key // Subscription id
summary: bool, readonly // Is client requesting summary data
batch: list[event], private|local|not_null // Events to be handled in next batch
construct() int16
addEvent(event e) void
processEvents() void
}
}
}