syhlion / gusher.cluster

gusher plus version, support cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

提供客端 查詢 command api 擴展

syhlion opened this issue · comments

commented
  • 在Subscribe Unsubscribe 的命令之外提供 exec

command

{
    "event":"gusher.exec_{apiName}",
    "data":"你想要執行的api 參數 可以json or string"
}

reply

{
    "event":"gusher.exec_{apiName}_succeeded",
    "data":"api response data"
}

在連線時 資料格式須為

{
    "gusher":{
        "user_id":"Test_User",
        "channels":["AA","BB"],
        "app_key":"TEST",
        "allow_api":["apiName1@http://api/","apiName2@http://api2/","apiName3@http://api3/",...]
    }
}

此 api 不會馬上收到訊息,由redis rpop 去實做 slave 把 request 推到 redis ,由master去當worker真正執行 request,取回結果後,再推送回該請求client