相关疑难解决方法(0)

我可以在Swift代码中运行JavaScript吗?

我需要在Swift代码中包含JavaScript代码才能调用signalR聊天,这可能吗?如果没有,我可以转换它吗?

sendmessage 是一个按钮.

$(function () {
    // Declare a proxy to reference the hub.
    var chat = $.connection.chatHub;
    // Create a function that the hub can call to broadcast messages.
    chat.client.broadcastMessage = function (name, message) {
        // some code
    };

    // Start the connection.
    $.connection.hub.start().done(function () {
        $('#sendmessage').click(function () {
            // Call the Send method on the hub.
            chat.server.send('name', 'message');
        });
    });
});
Run Code Online (Sandbox Code Playgroud)

而signalr代码是:

    public void Send(string name, string message)
    {
        // Call the broadcastMessage method to update …
Run Code Online (Sandbox Code Playgroud)

javascript signalr swift

33
推荐指数
2
解决办法
2万
查看次数

标签 统计

javascript ×1

signalr ×1

swift ×1