When you create your socket, your application needs to wire up the ‘messagereceived’ event (see that page i linked). Basically the method is called any time messages arrive over the wire. When the event fires, you’ll want to apply your application logic to parse the message and handle it.
An example might look a bit like this:
ws = new WebSocket(CurrentGatewayUrl);
ws.MessageReceived += (sender, e) =>
{
try
{
var data = JsonConvert.DeserializeObject<TwitchMessageEnvelope>(e.Message);
if(data != null)
{
CallHandlingMethod(data);
}
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
Every time you receive a message, the .MessageReceived event will fire, and the message data will exist in the variable ‘e’. The code tries to deserialize the json object using the model ‘TwitchMessageEnvelope’ (which you have to make, based on API docs) and if it successfully deserializes (object != null), call the handling method to process the envelope object. (The handling object would deal with things like parsing the message for bits, or getting video information, or w/e endpoint your accessing)
OAuth keys are also not specific to partners, if you don’t have bits enabled you’ll probably get an error, but I haven’t actually tested that scenario - but you can still request the proper permissions in your app flow.
*Note: JsonConvert comes from the NuGet package ‘NewtonSoft Json’ If you don’t have it, you want it. Go get it.