我收到连接错误,因为无法连接,因为目标计算机主动拒绝它74.125.24.188:5235
代码:
xmppClient.XmppDomain = "gcm.googleapis.com";
xmppClient.Hostname = "fcm-xmpp.googleapis.com";
xmppClient.Port = 5235;
xmppClient.ResolveSrvRecords = false;
xmppClient.OldStyleSsl = true;
xmppClient.Username = senderId; // your sender id
xmppClient.Password = serverKey; // your server key
xmppClient.AutoRoster = false;
xmppClient.AutoPresence = false;
xmppClient.Open();
var jsonMessgae = new JObject(new
{
notification = new
{
title = "Portugal vs. Denmark",
body = "5 to 1"
},
message_id = Guid.NewGuid().ToString(),
to = testDeviceId
});
var msg = new Message { Id = Guid.NewGuid().ToString() };
msg.Add(new Gcm { Value = jsonMessgae.ToString() });
xmppClient.Send(msg);