xoxo419
V2EX  ›  问与答

小程序 wx.connectSocket 调试模式下可以使用 ip+端口连接么?

  •  
  •   xoxo419 · Oct 11, 2017 · 1367 views
    This topic created in 3162 days ago, the information mentioned may be changed or developed.

    测试代码如下, 但是边报错信息都没有, 开发工具上我也勾选了"开发环境不校验请求域名以及 TLS 版本"

    Page({
    
      onLoad: function () {
        wx.connectSocket({
          url: 'http://ip:8082'
        })
        wx.onSocketOpen(function(res) {
          console.log(res)
        })
        wx.onSocketError(function(res){
          console.log('WebSocket 连接打开失败,请检查!')
        })
      }
    })
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3750 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 04:33 · PVG 12:33 · LAX 21:33 · JFK 00:33
    ♥ Do have faith in what you're doing.