Giter VIP home page Giter VIP logo

Comments (6)

charleyw avatar charleyw commented on May 18, 2024

因为微信小程序用websocket的话,需要在小程序后台配置一个合法的域名,而且不能有端口号。所以我在代码里面默认注掉了。

如果要用的话,要么开 无appid的,要嘛就得在本地配置一下
简单说一下(以mac机器为例,安全域名是websocket.example.com):

  1. /etc/hosts文件中添加一行:
sudo sh -c 'echo "127.0.0.1       websocket.example.com">> /etc/hosts'
  1. 启动remotedev的时候用80端口
sudo remotedev --hostname=localhost --port=80
  1. 连接的代码用新的地址
function configureStore() {
  return createStore(reducer, compose(devTools({
    hostname: 'websocket.example.com',
    port: 80,
    secure: false
  })));
}

我没有没有实测,不过思路大概是这样的。

from wechat-weapp-redux-todos.

xiaoguozi avatar xiaoguozi commented on May 18, 2024

@charleyw 试了一下没有无appid的,但是我这边提示
issue1

issue2

是版本不对么?

from wechat-weapp-redux-todos.

charleyw avatar charleyw commented on May 18, 2024

我完了试一下,最近没弄,不知道微信是不是有更新

from wechat-weapp-redux-todos.

BleemIs42 avatar BleemIs42 commented on May 18, 2024

@xiaoguozi 我也遇到这个问题

from wechat-weapp-redux-todos.

lucienthink avatar lucienthink commented on May 18, 2024

@charleyw 一样的问题,求解

from wechat-weapp-redux-todos.

charleyw avatar charleyw commented on May 18, 2024

不好意思,好久没用了。这个问题的原因是因为微信的开发工具的运行环境里面不让使用 window 变量。而在那个 devtools的源码里面有一些地方使用了 window 变量,在执行过程中 window 是 undefined 所以会报错。

我把临时把源码改了,你更新一下代码应该就好了。

然后,微信开发工具提供了在开发环境不检查安全域名,所以,不需要使用我上面说的那么复杂的办法配置了。把开发环境不校验请求域名以及 TLS 版本选项勾上,就可以直接使用 localhost:5678访问了。

可以看一下 readme 我也更新了。

from wechat-weapp-redux-todos.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.