- List segmentations of an
$appid
$segments = MtHttp::get('segment/' . $appid);- Type definition
Set up nginx proxy to nodejs websocket
Tài liệu này trình bày hai cách cấu hình, https ở nginx -> wss nodejs hoặc từ https ở nginx -> ws ở nodejs
Để điều hướng request từ cổng 443 vào websocket server (demo bằng nodejs)
wss://domain.com/ws sẽ được chuyển về wss://127.0.0.1:2910| function addJquery(cb) { | |
| if (typeof(jQuery) !== 'undefined') return; | |
| var url = 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js'; | |
| var scr = document.createElement('script'); scr.setAttribute('type', 'text/javascript'); scr.setAttribute('src', url); | |
| var head = document.getElementsByTagName('head')[0]; head.insertBefore(scr, head.firstChild); | |
| } | |
| addJquery(); |
| var loadjQuery = function(cb){ | |
| if(typeof(jQuery) == 'undefined'){ | |
| var scr = document.createElement('script'); | |
| scr.setAttribute('type', 'text/javascript'); | |
| scr.setAttribute('src', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js'); | |
| if(scr.readyState){ | |
| scr.onreadystatechange = function(){ | |
| if(scr.readyState === 'complete' || scr.readyState === 'loaded'){ | |
| scr.onreadystatechange = null; |
| GET /segment/{appid}/{segmentid}/listUser/{page}/{field1}/{field2} | |
| {appid} : id của ứng dụng | |
| {segmentid}: segment id | |
| {page}: dùng trong phân trang, {page} quy định số thứ tự của trang ( mỗi trang có cố định 100 phần tử) | |
| {field1}: code của filter1 ví dụ: _os, age, _revenue | |
| {field2}: [có thể bỏ trổng] code của filter2 | |
| kết quả trả ra là mảng bản ghi user dưới dạng json |
| var n = 0; | |
| var myCursor = db.warehouseproducts.find(); | |
| while (myCursor.hasNext()) { | |
| var doc = myCursor.next(); | |
| var locationMap = {}; | |
| for (var i = 0 ; i < doc.locations.length; i++) | |
| if (locationMap[doc.locations[i].location.str] !== undefined) { | |
| printjson(doc._id); | |
| n++; | |
| break; |
| *1 A die at 2 | |
| B cant send message 5 -> tell C to discard the previous package | |
| message is stored in B, if A is the root -> B discard the message | |
| else | |
| 2 B down at 2 | |
| A wait for ACK and retry on new B | |
| *3 A down at 3 |
| Vagrant.configure(2) do |config| | |
| config.vm.box = "ubuntu/xenial64" | |
| config.vm.network "public_network" | |
| config.vm.provider "virtualbox" do |vb| | |
| vb.memory = "2048" | |
| end | |
| config.vm.hostname = "kube" | |
| config.vm.provision "shell", inline: <<-SHELL |
| watch -n 1 'echo "GKE===================" && kubectl get pod --context="gke_subiz-version-4_us-central1-a_app-cluster-1" && echo "DEV===================" && kubectl get pod' |