My goal is to get information about the incoming donate through sockets: name, amount
The network has the following article which briefly describes the interaction with donationalerts in JavaScript
Below is the code from the article.
var socket = io("socket.donationalerts.ru:3001"); socket.emit('add-user', {token: "Ваш токен", type: "minor"}); socket.on('donation', function(msg){ // Ваша функция, обрабатывающая донат });
I am trying to convert the code under C #. SocketIO4Net.Client library is used for interaction .
However, I don’t know how to convert the following part of the { token: "my-token", type: "minor"}
type to dynamic? The Emit
method Emit
input (string eventName, dynamic payload)
, how do braces turn into dynamic
? There is an assumption that this is JSON
socket = new Client("socket.donationalerts.ru:3001"); socket.Emit("add-user", { token: "12345", type: "minor"}); socket.On("donation", (data) => { // Ваша функция, обрабатывающая донат var test = data; });
C#
it is not paste-paste. - NewView