socket.ioのチャットプログラムを読む
なんとなく分かった気になる。
- socket.io sample 3つ
- これらを読むためのマニュアル
- メモ
- lengthは対象が配列なら配列の数を返す。文字列の場合は文字列の数。
- パスの取り方はいろいろある。__dirname, process.cwd() etc.
- path.existsみたくコールバック使うやつもいる。path - Node.js Manual & Documentation
- jquery使うとすっきり。(文法に違和感があるが)
- サーバー、クライアント両方で同じ関数が使えるのは便利。console.log()とか。
- reconnectingが実装されたのは 0.6.3 node.js で エコーサーバと簡易コンテンツサーバ - but hopefulの中の js/Socket.IO/socket.io.js は 0.6 なので注意。
- クエリーの展開は以下が分かりやすかったので引用
url.parse(string).query | url.parse(string).pathname | | | | | ------ ------------------- http://localhost:8888/start?foo=bar&hello=world --- ----- | | | | querystring(string)["foo"] | | querystring(string)["hello"]