isomorfeus-iodine 0.7.49 → 0.7.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +17 -3
- data/Rakefile +1 -9
- data/examples/etag.ru +16 -0
- data/ext/{iodine → iodine_ext}/extconf.rb +1 -1
- data/ext/{iodine → iodine_ext}/fio.c +0 -0
- data/ext/{iodine → iodine_ext}/fio.h +0 -0
- data/ext/{iodine → iodine_ext}/fio_cli.c +0 -0
- data/ext/{iodine → iodine_ext}/fio_cli.h +189 -189
- data/ext/{iodine → iodine_ext}/fio_json_parser.h +687 -687
- data/ext/{iodine → iodine_ext}/fio_siphash.c +157 -157
- data/ext/{iodine → iodine_ext}/fio_siphash.h +37 -37
- data/ext/{iodine → iodine_ext}/fio_tls.h +129 -129
- data/ext/{iodine → iodine_ext}/fio_tls_missing.c +0 -0
- data/ext/{iodine → iodine_ext}/fio_tls_openssl.c +0 -0
- data/ext/{iodine → iodine_ext}/fio_tmpfile.h +0 -0
- data/ext/{iodine → iodine_ext}/fiobj.h +44 -44
- data/ext/{iodine → iodine_ext}/fiobj4fio.h +21 -21
- data/ext/{iodine → iodine_ext}/fiobj_ary.c +333 -333
- data/ext/{iodine → iodine_ext}/fiobj_ary.h +139 -139
- data/ext/{iodine → iodine_ext}/fiobj_data.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_data.h +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_hash.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_hash.h +176 -176
- data/ext/{iodine → iodine_ext}/fiobj_json.c +622 -622
- data/ext/{iodine → iodine_ext}/fiobj_json.h +68 -68
- data/ext/{iodine → iodine_ext}/fiobj_mem.h +71 -71
- data/ext/{iodine → iodine_ext}/fiobj_mustache.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_mustache.h +62 -62
- data/ext/{iodine → iodine_ext}/fiobj_numbers.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_numbers.h +127 -127
- data/ext/{iodine → iodine_ext}/fiobj_str.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_str.h +172 -172
- data/ext/{iodine → iodine_ext}/fiobject.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobject.h +0 -0
- data/ext/{iodine → iodine_ext}/hpack.h +1923 -1923
- data/ext/{iodine → iodine_ext}/http.c +14 -27
- data/ext/{iodine → iodine_ext}/http.h +1002 -1002
- data/ext/{iodine → iodine_ext}/http1.c +0 -0
- data/ext/{iodine → iodine_ext}/http1.h +29 -29
- data/ext/{iodine → iodine_ext}/http1_parser.h +0 -0
- data/ext/{iodine → iodine_ext}/http_internal.c +0 -0
- data/ext/{iodine → iodine_ext}/http_internal.h +0 -0
- data/ext/{iodine → iodine_ext}/http_mime_parser.h +350 -350
- data/ext/{iodine → iodine_ext}/iodine.c +1 -1
- data/ext/{iodine → iodine_ext}/iodine.h +0 -0
- data/ext/{iodine → iodine_ext}/iodine_caller.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_caller.h +0 -0
- data/ext/{iodine → iodine_ext}/iodine_connection.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_connection.h +55 -55
- data/ext/{iodine → iodine_ext}/iodine_defer.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_defer.h +6 -6
- data/ext/{iodine → iodine_ext}/iodine_fiobj2rb.h +120 -120
- data/ext/{iodine → iodine_ext}/iodine_helpers.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_helpers.h +12 -12
- data/ext/{iodine → iodine_ext}/iodine_http.c +0 -2
- data/ext/{iodine → iodine_ext}/iodine_http.h +23 -23
- data/ext/{iodine → iodine_ext}/iodine_json.c +302 -302
- data/ext/{iodine → iodine_ext}/iodine_json.h +6 -6
- data/ext/{iodine → iodine_ext}/iodine_mustache.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_mustache.h +6 -6
- data/ext/{iodine → iodine_ext}/iodine_pubsub.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_pubsub.h +26 -26
- data/ext/{iodine → iodine_ext}/iodine_rack_io.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_rack_io.h +20 -20
- data/ext/{iodine → iodine_ext}/iodine_store.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_store.h +20 -20
- data/ext/{iodine → iodine_ext}/iodine_tcp.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_tcp.h +0 -0
- data/ext/{iodine → iodine_ext}/iodine_tls.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_tls.h +13 -13
- data/ext/{iodine → iodine_ext}/mustache_parser.h +0 -0
- data/ext/{iodine → iodine_ext}/redis_engine.c +0 -0
- data/ext/{iodine → iodine_ext}/redis_engine.h +0 -0
- data/ext/{iodine → iodine_ext}/resp_parser.h +0 -0
- data/ext/{iodine → iodine_ext}/websocket_parser.h +505 -505
- data/ext/{iodine → iodine_ext}/websockets.c +0 -0
- data/ext/{iodine → iodine_ext}/websockets.h +185 -185
- data/isomorfeus-iodine.gemspec +1 -2
- data/lib/iodine/version.rb +1 -1
- data/lib/iodine.rb +1 -1
- metadata +79 -78
File without changes
|
@@ -1,185 +1,185 @@
|
|
1
|
-
/*
|
2
|
-
copyright: Boaz Segev, 2016-2019
|
3
|
-
license: MIT
|
4
|
-
|
5
|
-
Feel free to copy, use and enjoy according to the license provided.
|
6
|
-
*/
|
7
|
-
#ifndef H_WEBSOCKETS_H
|
8
|
-
#define H_WEBSOCKETS_H
|
9
|
-
|
10
|
-
#include <http.h>
|
11
|
-
|
12
|
-
/* support C++ */
|
13
|
-
#ifdef __cplusplus
|
14
|
-
extern "C" {
|
15
|
-
#endif
|
16
|
-
|
17
|
-
/** used internally: attaches the Websocket protocol to the socket. */
|
18
|
-
void websocket_attach(intptr_t uuid, http_settings_s *http_settings,
|
19
|
-
websocket_settings_s *args, void *data, size_t length);
|
20
|
-
|
21
|
-
/* *****************************************************************************
|
22
|
-
Websocket information
|
23
|
-
***************************************************************************** */
|
24
|
-
|
25
|
-
/** Returns the opaque user data associated with the websocket. */
|
26
|
-
void *websocket_udata_get(ws_s *ws);
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Sets the opaque user data associated with the websocket.
|
30
|
-
*
|
31
|
-
* Returns the old value, if any.
|
32
|
-
*/
|
33
|
-
void *websocket_udata_set(ws_s *ws, void *udata);
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Returns the underlying socket UUID.
|
37
|
-
*
|
38
|
-
* This is only relevant for collecting the protocol object from outside of
|
39
|
-
* websocket events, as the socket shouldn't be written to.
|
40
|
-
*/
|
41
|
-
intptr_t websocket_uuid(ws_s *ws);
|
42
|
-
|
43
|
-
/**
|
44
|
-
* Returns 1 if the WebSocket connection is in Client mode (connected to a
|
45
|
-
* remote server) and 0 if the connection is in Server mode (a connection
|
46
|
-
* established using facil.io's HTTP server).
|
47
|
-
*/
|
48
|
-
uint8_t websocket_is_client(ws_s *ws);
|
49
|
-
|
50
|
-
/* *****************************************************************************
|
51
|
-
Websocket Connection Management (write / close)
|
52
|
-
***************************************************************************** */
|
53
|
-
|
54
|
-
/** Writes data to the websocket. Returns -1 on failure (0 on success). */
|
55
|
-
int websocket_write(ws_s *ws, fio_str_info_s msg, uint8_t is_text);
|
56
|
-
/** Closes a websocket connection. */
|
57
|
-
void websocket_close(ws_s *ws);
|
58
|
-
|
59
|
-
/* *****************************************************************************
|
60
|
-
Websocket Pub/Sub
|
61
|
-
=================
|
62
|
-
|
63
|
-
API for websocket pub/sub that can be used to publish messages across process
|
64
|
-
boundries.
|
65
|
-
|
66
|
-
Supports pub/sub engines (see {pubsub.h}) that can connect to a backend service
|
67
|
-
such as Redis.
|
68
|
-
|
69
|
-
The default pub/sub engine (if `NULL` or unspecified) will publish the messages
|
70
|
-
to the process cluster (all the processes in `fio_run`).
|
71
|
-
|
72
|
-
To publish to a channel, use the API provided in {pubsub.h}.
|
73
|
-
***************************************************************************** */
|
74
|
-
|
75
|
-
/** Possible arguments for the {websocket_subscribe} function. */
|
76
|
-
struct websocket_subscribe_s {
|
77
|
-
/** the websocket receiving the message. REQUIRED. */
|
78
|
-
ws_s *ws;
|
79
|
-
/** the channel where the message was published. */
|
80
|
-
fio_str_info_s channel;
|
81
|
-
/**
|
82
|
-
* The callback that handles pub/sub notifications.
|
83
|
-
*
|
84
|
-
* Default: send directly to websocket client.
|
85
|
-
*/
|
86
|
-
void (*on_message)(ws_s *ws, fio_str_info_s channel, fio_str_info_s msg,
|
87
|
-
void *udata);
|
88
|
-
/**
|
89
|
-
* An optional cleanup callback for the `udata`.
|
90
|
-
*/
|
91
|
-
void (*on_unsubscribe)(void *udata);
|
92
|
-
/** User opaque data, passed along to the notification. */
|
93
|
-
void *udata;
|
94
|
-
/** An optional callback for pattern matching. */
|
95
|
-
fio_match_fn match;
|
96
|
-
/**
|
97
|
-
* When using client forwarding (no `on_message` callback), this indicates if
|
98
|
-
* messages should be sent to the client as binary blobs, which is the safest
|
99
|
-
* approach.
|
100
|
-
*
|
101
|
-
* Default: tests for UTF-8 data encoding and sends as text if valid UTF-8.
|
102
|
-
* Messages above ~32Kb are always assumed to be binary.
|
103
|
-
*/
|
104
|
-
unsigned force_binary : 1;
|
105
|
-
/**
|
106
|
-
* When using client forwarding (no `on_message` callback), this indicates if
|
107
|
-
* messages should be sent to the client as text.
|
108
|
-
*
|
109
|
-
* `force_binary` has precedence.
|
110
|
-
*
|
111
|
-
* Default: see above.
|
112
|
-
*
|
113
|
-
*/
|
114
|
-
unsigned force_text : 1;
|
115
|
-
};
|
116
|
-
|
117
|
-
/**
|
118
|
-
* Subscribes to a channel. See {struct websocket_subscribe_s} for possible
|
119
|
-
* arguments.
|
120
|
-
*
|
121
|
-
* Returns a subscription ID on success and 0 on failure.
|
122
|
-
*
|
123
|
-
* All subscriptions are automatically revoked once the websocket is closed.
|
124
|
-
*
|
125
|
-
* If the connections subscribes to the same channel more than once, messages
|
126
|
-
* will be merged. However, another subscription ID will be assigned, since two
|
127
|
-
* calls to {websocket_unsubscribe} will be required in order to unregister from
|
128
|
-
* the channel.
|
129
|
-
*/
|
130
|
-
uintptr_t websocket_subscribe(struct websocket_subscribe_s args);
|
131
|
-
|
132
|
-
#define websocket_subscribe(wbsckt, ...) \
|
133
|
-
websocket_subscribe((struct websocket_subscribe_s){.ws = wbsckt, __VA_ARGS__})
|
134
|
-
|
135
|
-
/**
|
136
|
-
* Unsubscribes from a channel.
|
137
|
-
*
|
138
|
-
* Failures are silent.
|
139
|
-
*
|
140
|
-
* All subscriptions are automatically revoked once the websocket is closed. So
|
141
|
-
* only use this function to unsubscribe while the websocket is open.
|
142
|
-
*/
|
143
|
-
void websocket_unsubscribe(ws_s *ws, uintptr_t subscription_id);
|
144
|
-
|
145
|
-
/** Optimize generic broadcasts, for use in websocket_optimize4broadcasts. */
|
146
|
-
#define WEBSOCKET_OPTIMIZE_PUBSUB (-32)
|
147
|
-
/** Optimize text broadcasts, for use in websocket_optimize4broadcasts. */
|
148
|
-
#define WEBSOCKET_OPTIMIZE_PUBSUB_TEXT (-33)
|
149
|
-
/** Optimize binary broadcasts, for use in websocket_optimize4broadcasts. */
|
150
|
-
#define WEBSOCKET_OPTIMIZE_PUBSUB_BINARY (-34)
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Enables (or disables) broadcast optimizations.
|
154
|
-
*
|
155
|
-
* This is performed automatically by the `websocket_subscribe` function.
|
156
|
-
* However, this function is provided for enabling the pub/sub metadata based
|
157
|
-
* optimizations for external connections / subscriptions.
|
158
|
-
*
|
159
|
-
* This function allows enablement (or disablement) of these optimizations:
|
160
|
-
*
|
161
|
-
* * WEBSOCKET_OPTIMIZE_PUBSUB - optimize all direct transmission messages,
|
162
|
-
* best attempt to detect Text vs. Binary data.
|
163
|
-
* * WEBSOCKET_OPTIMIZE_PUBSUB_TEXT - optimize direct pub/sub text messages.
|
164
|
-
* * WEBSOCKET_OPTIMIZE_PUBSUB_BINARY - optimize direct pub/sub binary messages.
|
165
|
-
*
|
166
|
-
* Note: to disable an optimization it should be disabled the same amount of
|
167
|
-
* times it was enabled - multiple optimization enablements for the same type
|
168
|
-
* are merged, but reference counted (disabled when reference is zero).
|
169
|
-
*
|
170
|
-
* Note2: The pub/sub metadata type ID will match the optimnization type
|
171
|
-
* requested (i.e., `WEBSOCKET_OPTIMIZE_PUBSUB`) and the optimized data is a
|
172
|
-
* FIOBJ String containing a pre-encoded WebSocket packet ready to be sent.
|
173
|
-
* i.e.:
|
174
|
-
*
|
175
|
-
* FIOBJ pre_wrapped = (FIOBJ)fio_message_metadata(msg,
|
176
|
-
* WEBSOCKET_OPTIMIZE_PUBSUB);
|
177
|
-
* fiobj_send_free((intptr_t)msg->udata1, fiobj_dup(pre_wrapped));
|
178
|
-
*/
|
179
|
-
void websocket_optimize4broadcasts(intptr_t type, int enable);
|
180
|
-
|
181
|
-
#ifdef __cplusplus
|
182
|
-
} /* extern "C" */
|
183
|
-
#endif
|
184
|
-
|
185
|
-
#endif
|
1
|
+
/*
|
2
|
+
copyright: Boaz Segev, 2016-2019
|
3
|
+
license: MIT
|
4
|
+
|
5
|
+
Feel free to copy, use and enjoy according to the license provided.
|
6
|
+
*/
|
7
|
+
#ifndef H_WEBSOCKETS_H
|
8
|
+
#define H_WEBSOCKETS_H
|
9
|
+
|
10
|
+
#include <http.h>
|
11
|
+
|
12
|
+
/* support C++ */
|
13
|
+
#ifdef __cplusplus
|
14
|
+
extern "C" {
|
15
|
+
#endif
|
16
|
+
|
17
|
+
/** used internally: attaches the Websocket protocol to the socket. */
|
18
|
+
void websocket_attach(intptr_t uuid, http_settings_s *http_settings,
|
19
|
+
websocket_settings_s *args, void *data, size_t length);
|
20
|
+
|
21
|
+
/* *****************************************************************************
|
22
|
+
Websocket information
|
23
|
+
***************************************************************************** */
|
24
|
+
|
25
|
+
/** Returns the opaque user data associated with the websocket. */
|
26
|
+
void *websocket_udata_get(ws_s *ws);
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Sets the opaque user data associated with the websocket.
|
30
|
+
*
|
31
|
+
* Returns the old value, if any.
|
32
|
+
*/
|
33
|
+
void *websocket_udata_set(ws_s *ws, void *udata);
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Returns the underlying socket UUID.
|
37
|
+
*
|
38
|
+
* This is only relevant for collecting the protocol object from outside of
|
39
|
+
* websocket events, as the socket shouldn't be written to.
|
40
|
+
*/
|
41
|
+
intptr_t websocket_uuid(ws_s *ws);
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Returns 1 if the WebSocket connection is in Client mode (connected to a
|
45
|
+
* remote server) and 0 if the connection is in Server mode (a connection
|
46
|
+
* established using facil.io's HTTP server).
|
47
|
+
*/
|
48
|
+
uint8_t websocket_is_client(ws_s *ws);
|
49
|
+
|
50
|
+
/* *****************************************************************************
|
51
|
+
Websocket Connection Management (write / close)
|
52
|
+
***************************************************************************** */
|
53
|
+
|
54
|
+
/** Writes data to the websocket. Returns -1 on failure (0 on success). */
|
55
|
+
int websocket_write(ws_s *ws, fio_str_info_s msg, uint8_t is_text);
|
56
|
+
/** Closes a websocket connection. */
|
57
|
+
void websocket_close(ws_s *ws);
|
58
|
+
|
59
|
+
/* *****************************************************************************
|
60
|
+
Websocket Pub/Sub
|
61
|
+
=================
|
62
|
+
|
63
|
+
API for websocket pub/sub that can be used to publish messages across process
|
64
|
+
boundries.
|
65
|
+
|
66
|
+
Supports pub/sub engines (see {pubsub.h}) that can connect to a backend service
|
67
|
+
such as Redis.
|
68
|
+
|
69
|
+
The default pub/sub engine (if `NULL` or unspecified) will publish the messages
|
70
|
+
to the process cluster (all the processes in `fio_run`).
|
71
|
+
|
72
|
+
To publish to a channel, use the API provided in {pubsub.h}.
|
73
|
+
***************************************************************************** */
|
74
|
+
|
75
|
+
/** Possible arguments for the {websocket_subscribe} function. */
|
76
|
+
struct websocket_subscribe_s {
|
77
|
+
/** the websocket receiving the message. REQUIRED. */
|
78
|
+
ws_s *ws;
|
79
|
+
/** the channel where the message was published. */
|
80
|
+
fio_str_info_s channel;
|
81
|
+
/**
|
82
|
+
* The callback that handles pub/sub notifications.
|
83
|
+
*
|
84
|
+
* Default: send directly to websocket client.
|
85
|
+
*/
|
86
|
+
void (*on_message)(ws_s *ws, fio_str_info_s channel, fio_str_info_s msg,
|
87
|
+
void *udata);
|
88
|
+
/**
|
89
|
+
* An optional cleanup callback for the `udata`.
|
90
|
+
*/
|
91
|
+
void (*on_unsubscribe)(void *udata);
|
92
|
+
/** User opaque data, passed along to the notification. */
|
93
|
+
void *udata;
|
94
|
+
/** An optional callback for pattern matching. */
|
95
|
+
fio_match_fn match;
|
96
|
+
/**
|
97
|
+
* When using client forwarding (no `on_message` callback), this indicates if
|
98
|
+
* messages should be sent to the client as binary blobs, which is the safest
|
99
|
+
* approach.
|
100
|
+
*
|
101
|
+
* Default: tests for UTF-8 data encoding and sends as text if valid UTF-8.
|
102
|
+
* Messages above ~32Kb are always assumed to be binary.
|
103
|
+
*/
|
104
|
+
unsigned force_binary : 1;
|
105
|
+
/**
|
106
|
+
* When using client forwarding (no `on_message` callback), this indicates if
|
107
|
+
* messages should be sent to the client as text.
|
108
|
+
*
|
109
|
+
* `force_binary` has precedence.
|
110
|
+
*
|
111
|
+
* Default: see above.
|
112
|
+
*
|
113
|
+
*/
|
114
|
+
unsigned force_text : 1;
|
115
|
+
};
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Subscribes to a channel. See {struct websocket_subscribe_s} for possible
|
119
|
+
* arguments.
|
120
|
+
*
|
121
|
+
* Returns a subscription ID on success and 0 on failure.
|
122
|
+
*
|
123
|
+
* All subscriptions are automatically revoked once the websocket is closed.
|
124
|
+
*
|
125
|
+
* If the connections subscribes to the same channel more than once, messages
|
126
|
+
* will be merged. However, another subscription ID will be assigned, since two
|
127
|
+
* calls to {websocket_unsubscribe} will be required in order to unregister from
|
128
|
+
* the channel.
|
129
|
+
*/
|
130
|
+
uintptr_t websocket_subscribe(struct websocket_subscribe_s args);
|
131
|
+
|
132
|
+
#define websocket_subscribe(wbsckt, ...) \
|
133
|
+
websocket_subscribe((struct websocket_subscribe_s){.ws = wbsckt, __VA_ARGS__})
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Unsubscribes from a channel.
|
137
|
+
*
|
138
|
+
* Failures are silent.
|
139
|
+
*
|
140
|
+
* All subscriptions are automatically revoked once the websocket is closed. So
|
141
|
+
* only use this function to unsubscribe while the websocket is open.
|
142
|
+
*/
|
143
|
+
void websocket_unsubscribe(ws_s *ws, uintptr_t subscription_id);
|
144
|
+
|
145
|
+
/** Optimize generic broadcasts, for use in websocket_optimize4broadcasts. */
|
146
|
+
#define WEBSOCKET_OPTIMIZE_PUBSUB (-32)
|
147
|
+
/** Optimize text broadcasts, for use in websocket_optimize4broadcasts. */
|
148
|
+
#define WEBSOCKET_OPTIMIZE_PUBSUB_TEXT (-33)
|
149
|
+
/** Optimize binary broadcasts, for use in websocket_optimize4broadcasts. */
|
150
|
+
#define WEBSOCKET_OPTIMIZE_PUBSUB_BINARY (-34)
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Enables (or disables) broadcast optimizations.
|
154
|
+
*
|
155
|
+
* This is performed automatically by the `websocket_subscribe` function.
|
156
|
+
* However, this function is provided for enabling the pub/sub metadata based
|
157
|
+
* optimizations for external connections / subscriptions.
|
158
|
+
*
|
159
|
+
* This function allows enablement (or disablement) of these optimizations:
|
160
|
+
*
|
161
|
+
* * WEBSOCKET_OPTIMIZE_PUBSUB - optimize all direct transmission messages,
|
162
|
+
* best attempt to detect Text vs. Binary data.
|
163
|
+
* * WEBSOCKET_OPTIMIZE_PUBSUB_TEXT - optimize direct pub/sub text messages.
|
164
|
+
* * WEBSOCKET_OPTIMIZE_PUBSUB_BINARY - optimize direct pub/sub binary messages.
|
165
|
+
*
|
166
|
+
* Note: to disable an optimization it should be disabled the same amount of
|
167
|
+
* times it was enabled - multiple optimization enablements for the same type
|
168
|
+
* are merged, but reference counted (disabled when reference is zero).
|
169
|
+
*
|
170
|
+
* Note2: The pub/sub metadata type ID will match the optimnization type
|
171
|
+
* requested (i.e., `WEBSOCKET_OPTIMIZE_PUBSUB`) and the optimized data is a
|
172
|
+
* FIOBJ String containing a pre-encoded WebSocket packet ready to be sent.
|
173
|
+
* i.e.:
|
174
|
+
*
|
175
|
+
* FIOBJ pre_wrapped = (FIOBJ)fio_message_metadata(msg,
|
176
|
+
* WEBSOCKET_OPTIMIZE_PUBSUB);
|
177
|
+
* fiobj_send_free((intptr_t)msg->udata1, fiobj_dup(pre_wrapped));
|
178
|
+
*/
|
179
|
+
void websocket_optimize4broadcasts(intptr_t type, int enable);
|
180
|
+
|
181
|
+
#ifdef __cplusplus
|
182
|
+
} /* extern "C" */
|
183
|
+
#endif
|
184
|
+
|
185
|
+
#endif
|
data/isomorfeus-iodine.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = %w(lib ext)
|
25
25
|
|
26
|
-
spec.extensions = %w(ext/
|
26
|
+
spec.extensions = %w(ext/iodine_ext/extconf.rb)
|
27
27
|
|
28
28
|
spec.required_ruby_version = '>= 3.1.0'
|
29
29
|
|
@@ -34,7 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.requirements << 'TLS requires OpenSSL >= 1.1.0.'
|
35
35
|
spec.requirements << 'Or Windows with Ruby >= 3.0.0 build with MingW and MingW as compiler.'
|
36
36
|
|
37
|
-
# spec.add_development_dependency 'bundler', '>= 1.10', '< 2.0'
|
38
37
|
spec.add_development_dependency 'rake', '~> 13.0', '< 14.0'
|
39
38
|
spec.add_development_dependency 'minitest', '>=5', '< 6.0'
|
40
39
|
spec.add_development_dependency 'rspec', '>=3.9.0', '< 4.0'
|
data/lib/iodine/version.rb
CHANGED
data/lib/iodine.rb
CHANGED
@@ -3,7 +3,7 @@ require 'socket' # TCPSocket is used internally for Hijack support
|
|
3
3
|
# require 'openssl' # For SSL/TLS support using OpenSSL
|
4
4
|
|
5
5
|
require 'iodine/version'
|
6
|
-
require '
|
6
|
+
require 'iodine_ext' # loading a binary C extension
|
7
7
|
|
8
8
|
# Iodine is an HTTP / WebSocket server as well as an Evented Network Tool Library. In essense, Iodine is a Ruby port for the [facil.io](http://facil.io) C library.
|
9
9
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-iodine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.50
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -116,7 +116,7 @@ email:
|
|
116
116
|
executables:
|
117
117
|
- iodine
|
118
118
|
extensions:
|
119
|
-
- ext/
|
119
|
+
- ext/iodine_ext/extconf.rb
|
120
120
|
extra_rdoc_files: []
|
121
121
|
files:
|
122
122
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- examples/async_task.ru
|
147
147
|
- examples/config.ru
|
148
148
|
- examples/echo.ru
|
149
|
+
- examples/etag.ru
|
149
150
|
- examples/hello.ru
|
150
151
|
- examples/pubsub_engine.ru
|
151
152
|
- examples/redis.ru
|
@@ -154,80 +155,80 @@ files:
|
|
154
155
|
- examples/tcp_client.rb
|
155
156
|
- examples/x-sendfile.ru
|
156
157
|
- exe/iodine
|
157
|
-
- ext/
|
158
|
-
- ext/
|
159
|
-
- ext/
|
160
|
-
- ext/
|
161
|
-
- ext/
|
162
|
-
- ext/
|
163
|
-
- ext/
|
164
|
-
- ext/
|
165
|
-
- ext/
|
166
|
-
- ext/
|
167
|
-
- ext/
|
168
|
-
- ext/
|
169
|
-
- ext/
|
170
|
-
- ext/
|
171
|
-
- ext/
|
172
|
-
- ext/
|
173
|
-
- ext/
|
174
|
-
- ext/
|
175
|
-
- ext/
|
176
|
-
- ext/
|
177
|
-
- ext/
|
178
|
-
- ext/
|
179
|
-
- ext/
|
180
|
-
- ext/
|
181
|
-
- ext/
|
182
|
-
- ext/
|
183
|
-
- ext/
|
184
|
-
- ext/
|
185
|
-
- ext/
|
186
|
-
- ext/
|
187
|
-
- ext/
|
188
|
-
- ext/
|
189
|
-
- ext/
|
190
|
-
- ext/
|
191
|
-
- ext/
|
192
|
-
- ext/
|
193
|
-
- ext/
|
194
|
-
- ext/
|
195
|
-
- ext/
|
196
|
-
- ext/
|
197
|
-
- ext/
|
198
|
-
- ext/
|
199
|
-
- ext/
|
200
|
-
- ext/
|
201
|
-
- ext/
|
202
|
-
- ext/
|
203
|
-
- ext/
|
204
|
-
- ext/
|
205
|
-
- ext/
|
206
|
-
- ext/
|
207
|
-
- ext/
|
208
|
-
- ext/
|
209
|
-
- ext/
|
210
|
-
- ext/
|
211
|
-
- ext/
|
212
|
-
- ext/
|
213
|
-
- ext/
|
214
|
-
- ext/
|
215
|
-
- ext/
|
216
|
-
- ext/
|
217
|
-
- ext/
|
218
|
-
- ext/
|
219
|
-
- ext/
|
220
|
-
- ext/
|
221
|
-
- ext/
|
222
|
-
- ext/
|
223
|
-
- ext/
|
224
|
-
- ext/
|
225
|
-
- ext/
|
226
|
-
- ext/
|
227
|
-
- ext/
|
228
|
-
- ext/
|
229
|
-
- ext/
|
230
|
-
- ext/
|
158
|
+
- ext/iodine_ext/extconf.rb
|
159
|
+
- ext/iodine_ext/fio.c
|
160
|
+
- ext/iodine_ext/fio.h
|
161
|
+
- ext/iodine_ext/fio_cli.c
|
162
|
+
- ext/iodine_ext/fio_cli.h
|
163
|
+
- ext/iodine_ext/fio_json_parser.h
|
164
|
+
- ext/iodine_ext/fio_siphash.c
|
165
|
+
- ext/iodine_ext/fio_siphash.h
|
166
|
+
- ext/iodine_ext/fio_tls.h
|
167
|
+
- ext/iodine_ext/fio_tls_missing.c
|
168
|
+
- ext/iodine_ext/fio_tls_openssl.c
|
169
|
+
- ext/iodine_ext/fio_tmpfile.h
|
170
|
+
- ext/iodine_ext/fiobj.h
|
171
|
+
- ext/iodine_ext/fiobj4fio.h
|
172
|
+
- ext/iodine_ext/fiobj_ary.c
|
173
|
+
- ext/iodine_ext/fiobj_ary.h
|
174
|
+
- ext/iodine_ext/fiobj_data.c
|
175
|
+
- ext/iodine_ext/fiobj_data.h
|
176
|
+
- ext/iodine_ext/fiobj_hash.c
|
177
|
+
- ext/iodine_ext/fiobj_hash.h
|
178
|
+
- ext/iodine_ext/fiobj_json.c
|
179
|
+
- ext/iodine_ext/fiobj_json.h
|
180
|
+
- ext/iodine_ext/fiobj_mem.h
|
181
|
+
- ext/iodine_ext/fiobj_mustache.c
|
182
|
+
- ext/iodine_ext/fiobj_mustache.h
|
183
|
+
- ext/iodine_ext/fiobj_numbers.c
|
184
|
+
- ext/iodine_ext/fiobj_numbers.h
|
185
|
+
- ext/iodine_ext/fiobj_str.c
|
186
|
+
- ext/iodine_ext/fiobj_str.h
|
187
|
+
- ext/iodine_ext/fiobject.c
|
188
|
+
- ext/iodine_ext/fiobject.h
|
189
|
+
- ext/iodine_ext/hpack.h
|
190
|
+
- ext/iodine_ext/http.c
|
191
|
+
- ext/iodine_ext/http.h
|
192
|
+
- ext/iodine_ext/http1.c
|
193
|
+
- ext/iodine_ext/http1.h
|
194
|
+
- ext/iodine_ext/http1_parser.h
|
195
|
+
- ext/iodine_ext/http_internal.c
|
196
|
+
- ext/iodine_ext/http_internal.h
|
197
|
+
- ext/iodine_ext/http_mime_parser.h
|
198
|
+
- ext/iodine_ext/iodine.c
|
199
|
+
- ext/iodine_ext/iodine.h
|
200
|
+
- ext/iodine_ext/iodine_caller.c
|
201
|
+
- ext/iodine_ext/iodine_caller.h
|
202
|
+
- ext/iodine_ext/iodine_connection.c
|
203
|
+
- ext/iodine_ext/iodine_connection.h
|
204
|
+
- ext/iodine_ext/iodine_defer.c
|
205
|
+
- ext/iodine_ext/iodine_defer.h
|
206
|
+
- ext/iodine_ext/iodine_fiobj2rb.h
|
207
|
+
- ext/iodine_ext/iodine_helpers.c
|
208
|
+
- ext/iodine_ext/iodine_helpers.h
|
209
|
+
- ext/iodine_ext/iodine_http.c
|
210
|
+
- ext/iodine_ext/iodine_http.h
|
211
|
+
- ext/iodine_ext/iodine_json.c
|
212
|
+
- ext/iodine_ext/iodine_json.h
|
213
|
+
- ext/iodine_ext/iodine_mustache.c
|
214
|
+
- ext/iodine_ext/iodine_mustache.h
|
215
|
+
- ext/iodine_ext/iodine_pubsub.c
|
216
|
+
- ext/iodine_ext/iodine_pubsub.h
|
217
|
+
- ext/iodine_ext/iodine_rack_io.c
|
218
|
+
- ext/iodine_ext/iodine_rack_io.h
|
219
|
+
- ext/iodine_ext/iodine_store.c
|
220
|
+
- ext/iodine_ext/iodine_store.h
|
221
|
+
- ext/iodine_ext/iodine_tcp.c
|
222
|
+
- ext/iodine_ext/iodine_tcp.h
|
223
|
+
- ext/iodine_ext/iodine_tls.c
|
224
|
+
- ext/iodine_ext/iodine_tls.h
|
225
|
+
- ext/iodine_ext/mustache_parser.h
|
226
|
+
- ext/iodine_ext/redis_engine.c
|
227
|
+
- ext/iodine_ext/redis_engine.h
|
228
|
+
- ext/iodine_ext/resp_parser.h
|
229
|
+
- ext/iodine_ext/websocket_parser.h
|
230
|
+
- ext/iodine_ext/websockets.c
|
231
|
+
- ext/iodine_ext/websockets.h
|
231
232
|
- isomorfeus-iodine.gemspec
|
232
233
|
- lib/iodine.rb
|
233
234
|
- lib/iodine/connection.rb
|
@@ -246,7 +247,7 @@ metadata:
|
|
246
247
|
github_repo: ssh://github.com/isomorfeus/gems
|
247
248
|
source_code_uri: https://github.com/isomorfeus/isomorfeus-iodine
|
248
249
|
post_install_message: |-
|
249
|
-
Thank you for installing Iodine 0.7.
|
250
|
+
Thank you for installing Iodine 0.7.50.
|
250
251
|
Remember: if iodine supports your business, it's only fair to give value back (code contributions / donations) to Bo, see https://github.com/boazsegev/iodine
|
251
252
|
rdoc_options: []
|
252
253
|
require_paths:
|