我想用RedisToGo在Heroku上使用套接字io。在當地環境中,一切都很好。在Heroku上不能使用socket.io和redis
當我部署我的代碼到Heroku的,大部分我得到400錯誤的請求從瀏覽器下面的數據的時間:
{"code":1,"message":"Session ID unknown"}
我Redis的配置是:
var url = "redis://redistogo:[email protected]:xxxx/";
var rtg = require("url").parse(url);
var pub = redis.createClient(rtg.port, rtg.hostname, {return_buffers: true});
var sub = redis.createClient(rtg.port, rtg.hostname, {return_buffers: true});
pub.auth(rtg.auth.split(":")[1]);
sub.auth(rtg.auth.split(":")[1]);
var redisOptions = {
pubClient: pub,
subClient: sub,
host: rtg.hostname,
port: rtg.port
};
io.adapter(ioredis(redisOptions));
什麼問題是什麼?