0

大家好,我只是在测试信号器,我玩得很开心,离我通常的技能有点远,现在我的问题是我可以将一个列表传递给客户这是我的代码

Public Sub Send(message As String, id As String)
        Dim tomessage = OnlineUser.userObj.Where(Function(users) users.userId = id).[Select](Function(users) users.connectionId).SingleOrDefault()
        Dim customers As New List(Of locationslist)

        customers.Add(New locationslist)
        customers((customers.Count - 1)).CITE_NR = message
        customers((customers.Count - 1)).LATITUDE = "114.20"
        customers((customers.Count - 1)).LONGITUDE = "115.20"
        customers((customers.Count - 1)).DATECOMTD = "01/01/2011"
        customers((customers.Count - 1)).CLASSOFF = "MURDER"
        customers((customers.Count - 1)).TIME = "01:20"
        customers((customers.Count - 1)).CASESTAT = "GSLVGED"

        Clients.Client(tomessage).receiveMessage(customers)
    End Sub

在客户端我正在这样做

            usr.client.receiveMessage = function (message) {
                alert("Received from server: " + message.CITE_NR);
            };

但不幸的是,消息说从服务器收到:未定义

这甚至可能吗谢谢你的帮助

4

1 回答 1

1

在 Clients.Client(tomessage).receiveMessage(customers) 中,customers 是一个列表。因此,您应该在 javascript 中使用 message[0].CITE_NR,或者在消息上使用 foreach(这是消息,而不是消息)。

于 2013-09-08T15:23:01.563 回答