CZauX wrote:Using Thread.Start is a blocking operation to the chromium rendering. I can spin up another thread on something like OnLoadEnd, but the problem becomes that unless I make the thread sleep, the main rendering stops. Since the Websocket is a server, I can't just put it to sleep.
The second problem with threading is that if I spin up another thread, it needs to be able to communicate with the browser instance to execute Javascript, so I have to have the thread executing in a specific location, or some other method of communication, and thats where I'm lost at. This seems to be more of an experience with CefGlue issue than a general C# problem, unless I'm majorly overlooking something.
Sorry, I'm far from you problem, and it is hard to understand without knowledge what exactly happend.
fddima wrote:Chromium in case of websokets will initiate HTTP handshake which you can spoof via CEF request handler. Then, if request hit you, you can allow to upgrade connection (and it will be no more HTTP), or reject connection upgrade, and in this case some http-based fallback should be used (but I'm not sure, need to play around or read some docs), but fallback should be used in case for pure HTTP proxies (but again needs to be checked). So, just for idea, if you can't change client code, may be easier 'take a look of dumb' and try to handle this over http (request handler),
Update: OnBeforeResourceLoad will not be called for WS HTTP handshake, but scheme handler factory will be used.or may be client code already can fallback to other strategy (XHR/long polling), which can be easily handled (again via request handler).
Things about Thread.Start... It is not blocking. You can spawn new threads many as you want. And it is bit hard to understand what problems with IPC. All of them are async, and if you need sync IPC - then you should implement own, but they usually bad because of blocking. ExecuteJavaScript method on other side is async, as any IPC with renderer. So actually I'm feel that you do something with js, but it is unclear how it connected to websockets. Anyway if you simulate somehow ws events - all of them are async. But WS is networking/channel, so again unclear how it connected to JS.