Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid header error #26

Open
manibharathytu opened this issue Oct 14, 2020 · 2 comments
Open

Invalid header error #26

manibharathytu opened this issue Oct 14, 2020 · 2 comments

Comments

@manibharathytu
Copy link

I replaced example.c url with this.
ws:https://www.bitmex.com/realtime

When I run, it gives the following error
(example.c:91) onerror:2: Invalid header

I'm able to connect to the same url with javascript in browser.
var ws = new WebSocket('ws:https://www.bitmex.com/realtime');

wss:https://echo.websocket.org - This url is working good from example.c

@qaxl
Copy link

qaxl commented Oct 14, 2020

Hello. Could you possibly provide snippet and whole error? Thank you. 👍

@manibharathytu
Copy link
Author

manibharathytu commented Oct 14, 2020

@U59


int main(int argc, char **argv)
{
	const char *url = "ws:https://www.bitmex.com/realtime";
    struct ev_loop *loop = EV_DEFAULT;
    struct ev_signal signal_watcher;
	int ping_interval = 10;	/* second */
    struct uwsc_client *cl;
	int opt;

    while ((opt = getopt(argc, argv, "u:P:")) != -1) {
        switch (opt) {
        case 'u':
            url = optarg;
            break;
		case 'P':
			ping_interval = atoi(optarg);
			break;
        default: /* '?' */
            usage(argv[0]);
        }
    }

	uwsc_log_info("Libuwsc: %s\n", UWSC_VERSION_STRING);

    cl = uwsc_new(loop, url, ping_interval, NULL);
    if (!cl)
        return -1;

	uwsc_log_info("Start connect...\n");

    cl->onopen = uwsc_onopen;
    cl->onmessage = uwsc_onmessage;
    cl->onerror = uwsc_onerror;
    cl->onclose = uwsc_onclose;

    ev_signal_init(&signal_watcher, signal_cb, SIGINT);
    ev_signal_start(loop, &signal_watcher);

    ev_run(loop, 0);

    free(cl);
    
    return 0;
}

This is the main function. If you want I can paste the full code. But it is just the /example/example.c file in this repository with the url changed

Error :
http:https://i.imgur.com/RlsocWl.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants