c# - Websocket-sharp not raising OnOpen event upon opening websocket -
i'm in stages of writing program interface ip camera. bit of code wrote yesterday worked, when came morning didn't. know, did something, best of memory worked when clicked debug before leaving , didn't when clicked debug when came in. left computer on vs running overnight (which never do, , have restarted since) , internet tabs left them. computer locked, unless resourceful individual decided mess me, nothing changed overnight.
i'm using websocket-sharp, , when connect websocket (which seem happen successfully), onopen event isn't raised.
the bit websocket-sharp raises event in following lines.
private void open () { _inmessage = true; startreceiving (); try { onopen.emit (this, eventargs.empty); } catch (exception ex) { _logger.error (ex.tostring ()); error ("an error has occurred during onopen event.", ex); }
it reaches onopen.emit, , doesn't throw exception, seems think it's raising event. event seen below
public event eventhandler onopen;
it not seem reach line when put breakpoint there isn't paused. i've never used .emit way of raising events before, , not finding in research, maybe somethings going wrong there?
my code below.
public form1() { initializecomponent(); this.shown += mainwindow_loaded; } void mainwindow_loaded(object sender, eventargs e) { using (var ws = new websocket("ws://169.254.101.183")) { ws.onmessage += (sender2, e2) => textbox1.text = e2.data.tostring(); ws.connect(); ws.onopen += (sender2,e2) => textbox1.text = "connected"; /*ws.onerror += (sender2, e2) => textbox1.text = e2.message;*/ //textbox1.text = "."; } }
is there obvious reason onopen.emit should not raise onopen event?
Comments
Post a Comment