dhbaird / easywsclient

A short and sweet WebSocket client for C++
MIT License
753 stars 204 forks source link

How to send json array #65

Closed developernew123 closed 6 years ago

developernew123 commented 6 years ago

I want to send an array like this to chrome after I connected to it using websockets and remote debugging

{ id: 2, method: 'Page.navigate', params: {url: 'http://twitter.com/#!/search/chrome?q=chrome&' + rand(100).to_s} }

developernew123 commented 6 years ago

I tried sending it from javascript and html5 websockets as a string like this : "{ \"id\":2,\"method\" : \"Page.navigate\",\"params\" : {\"url\":\"http://twitter.com/#!/search/chrome?q=chrome\"} }" and it worked

but still doesn't in c++

this is my code :

WebSocket::pointer ws = WebSocket::from_url(wsurl); assert(ws); ws->poll(); cout << "sending : " << strpayload << endl; ws->send(strpayload); ws->dispatch(writes); delete ws;