Connect ClearScript Debug Port through WebSockets

Dec 23, 2015 at 7:53 AM
Hi,

I Am trying to connect v8debug port through websockets using WebSockets4Net, we are passing messages through websockets to engine (in/out).

Code is as follows
                var v8Engine = new V8ScriptEngine(V8ScriptEngineFlags.DisableGlobalMembers | V8ScriptEngineFlags.EnableDebugging, 9622)
                 {
                     AllowReflection = false,
                 };

                WebSocket webscoketClient;
                webscoketClient = new WebSocket("ws://localhost:9622");
                webscoketClient.Opened += WebSocket_Opened;
                webscoketClient.MessageReceived += WebSocket_MessageReceived;
                webscoketClient.Error += WebSocket_Error;
                webscoketClient.Closed += WebSocket_Closed;
                webscoketClient.DataReceived += WebSocket_DataReceived;

                webscoketClient.Open();
When websocket connects its throwing exception.

Error Message:Type:connect
StackTrace
   at ConsoleAppV8Engine.Program.WebSocket_Error(Object sender, ErrorEventArgs e) in e:\Data\CodeKata\ConsoleAppV8Engine\ConsoleAppV8Engine\Program.cs:line 115
   at WebSocket4Net.WebSocket.OnError(ErrorEventArgs e)
   at WebSocket4Net.WebSocket.OnError(Exception e)
   at WebSocket4Net.WebSocket.FireError(Exception error)
   at WebSocket4Net.Command.Handshake.ExecuteCommand(WebSocket session, WebSocketCommandInfo commandInfo)
   at WebSocket4Net.WebSocket.ExecuteCommand(WebSocketCommandInfo commandInfo)
   at WebSocket4Net.WebSocket.OnDataReceived(Byte[] data, Int32 offset, Int32 length)
   at WebSocket4Net.WebSocket.client_DataReceived(Object sender, DataEventArgs e)
   at SuperSocket.ClientEngine.ClientSession.OnDataReceived(Byte[] data, Int32 offset, Int32 length)
   at SuperSocket.ClientEngine.AsyncTcpSession.ProcessReceive(SocketAsyncEventArgs e)
   at SuperSocket.ClientEngine.AsyncTcpSession.SocketEventArgsCompleted(Object sender, SocketAsyncEventArgs e)
   at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
   at System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(Object ignored)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
   at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Let me know does v8 support websockets for debugging

Thank you,
Praveen
Coordinator
Dec 23, 2015 at 12:28 PM
Hi Praveen,

Unfortunately ClearScript's V8 debug server does not support WebSocket.

Sorry!