+static int aws_new_token(struct afb_ws_json1 *ws, const char *new_token_string)
+{
+ int rc;
+ struct afb_token *newtok, *oldtok;
+
+ rc = afb_token_get(&newtok, new_token_string);
+ if (rc >= 0) {
+ oldtok = ws->token;
+ ws->token = newtok;
+ afb_token_unref(oldtok);
+ }
+ return rc;
+}
+