+/*
+ * Sends a variable list of texts to the endpoint of 'ws'.
+ * Returns 0 on success or -1 in case of error.
+ */
+int afb_ws_texts(struct afb_ws *ws, ...)
+{
+ va_list args;
+ struct iovec ios[32];
+ int count;
+ const char *s;
+
+ if (ws->ws == NULL) {
+ /* disconnected */
+ errno = EPIPE;
+ return -1;
+ }
+
+ count = 0;
+ va_start(args, ws);
+ s = va_arg(args, const char *);
+ while (s != NULL) {
+ if (count == 32) {
+ errno = EINVAL;
+ return -1;
+ }
+ ios[count].iov_base = (void*)s;
+ ios[count].iov_len = strlen(s);
+ count++;
+ s = va_arg(args, const char *);
+ }
+ va_end(args);
+ return websock_text_v(ws->ws, 1, ios, count);
+}
+
+/*
+ * Sends a text data described in the 'count' 'iovec' to the endpoint of 'ws'.
+ * Returns 0 on success or -1 in case of error.
+ */
+int afb_ws_text_v(struct afb_ws *ws, const struct iovec *iovec, int count)
+{
+ if (ws->ws == NULL) {
+ /* disconnected */
+ errno = EPIPE;
+ return -1;
+ }
+ return websock_text_v(ws->ws, 1, iovec, count);
+}
+