Node.js Cluster+Socket.IO+Redisによるリアルタイム通知システム | サイバーエージェント 公式エンジニアブログ
Node.js Cluster+Socket.IO+Redisによるリアルタイム通知システム | サイバーエージェント 公式エンジニアブログ
2. システム概要 homingは、アメーバピグ関連サービスのいずれかにログインしているユーザに対して、各サービスの通知情報を横断的にプッシュ通知します。 システムの構成は以下の通りです。 図2-1. システム概要 2-1. APIサーバ ユーザへの通知要求を受け付けるREST fullなAPIを備えたWebサーバです。 Node.jsのClusterによる、master/worker構成で稼働します。 通知要求はワーカプロセスで処理します。 図2-2. APIサーバ 2-2. Redisサーバ(データストア用) 一時的なデータをストアするためのRedisサーバです。 sentinelプロセスによる、master/slave構成で稼働します。 ストアされたデータはメモリ上のみで管理し、ディスクへの書き込みは行いません。 以下の情報を管理します。 ユーザのオンライン情報 ユーザIDの索
本連載では、GitHub社が開発したチャットbot開発・実行フレームワークである「Hubot」を使用して、チャットツールにオリジナルのbotを住まわせ、開発フローに組み込むことで開発を楽にする方法について解説していきます。 botとはなにか 開発の現場で、開発チーム内のコミュニケーションのためにIRCなどのチャットツールを導入することは、よく見る光景だと思います。そんなチャットツールに常駐してチャット経由でコマンドを待ち受けて実行したり、決められた条件に従ってチャットに発言してチャットの参加者に通知したりするようなプログラムのことをbotと呼びます。 Skype、HipChatやChatWorkなどコミュニケーションツールが多様化した現代においても、それぞれのチャットツールに対応したbotが開発されており、botを開発するためのフレームワークも様々な形で提供されています。botを導入するこ
1 pixel|サイバーエージェント公式クリエイターズブログ サイバーエージェントのクリエイターの取り組みを紹介するオフィシャルブログです。最新技術への挑戦やサービス誕生の裏話、勉強会やイベントのレポートなどCAクリエイターの情報が満載です。 こんにちは。Ameba事業本部の杉本と申します。 業務では「天下統一クロニクル」というチームでフロントエンドのディベロッパをしています。 今回は、「node-webkit」という一風変わったアプリケーションを紹介させていただきます。 私達は普段、gruntといったnode.js製のツールを使ってJavaScriptの結合や圧縮、画像の減色といった処理を自動化していますが、node-webkitはこれらnodeのモジュールを使ってGUIアプリケーションを作れるツールです。nodeの資産をそのまま利用できるので、私のようなディベロッパには嬉しいですね。
はじめに Unity の C# の世界で完結して色々と実行してくれるのはライブラリの利用者側から見るととても楽ですが、プロトタイプをそれで作ろうとすると結構大変です。そこで、Processing なり oF なり自分の慣れ親しんだ環境で作成したものを別途動かし、そこから OSC なりなんなりで通信して Unity の世界に反映させる、ということが良くやられていると思います。しかしながら、これを配布して別の人に使ってもらおうと考えると、別途色々と動かしてもらわないとならず大変です。 そこで、ここをうまい具合にやる方法を思いついたのでご紹介します。 アイディア アイディアとしては、何かしらのコマンドやStreamingAssets 下に置いたバイナリを System.Diagnostics.Process から実行するというシンプルなものです。先行事例だと、Unity でリアルタイムにリップシ
こんなエラーが出ました。 ~ # npm -v /cygdrive/c/App/nodejs/npm: line 2: $'\r': command not found /cygdrive/c/App/nodejs/npm: line 4: $'\r': command not found /cygdrive/c/App/nodejs/npm: line 5: syntax error near unexpected token `$'in\r'' ' ~ # /cygdrive/c/App/nodejs/npm を見てみると、改行コードがCRLFだったので、LFに変更したら直りました。 ググっても出てこなかったので、備忘録がてら記しておくことにしました。 僕だけ・・・?じゃないよなぁ。。
nexeはnode.js/JavaScript製のソフトウェア()です。 node.jsで開発したソフトウェアを配布する際には相手にもnode.jsをインストールしてもらわなければなりません。今時点ではこれは相当な面倒な作業に感じられるでしょう。そこで使ってみたいのがネイティブソフトウェア化してくれるnexeです。 実行中です。指定したnode.jsをダウンロードしてコンパイル、そしてラッピングまでを行ってくれます。 実行結果です。約10MBのバイナリができあがります。 Webサーバであればそのまま実行するだけでサーバが立ち上がります。 もちろんブラウザからもアクセス可能です。 ソースコードです。必要なライブラリもちゃんとラッピングしてバイナリ化されます。 nexeは今のところWindows向けのバイナリ生成はできません。しかしMac OSXであれば後は簡易的なGUIを付けてアプリ化するの
About Node.ACS Appcelerator Node.ACS enables you to develop and publish Node.js applications to the cloud. Node.ACS includes a simple command-line-interface and an MVC framework that makes it easy for both novice and experienced node.js developers to create apps and services. With Node.ACS, you can: Build custom services to extend the existing Appcelerator Cloud Services (ACS) Host your existing n
追記 2/22 毎回微妙に追記していますが、今回も追記です。最後にmongodbのinsert性能について80lines/secで厳しくなった、と書いてますが、環境か設定まわりがあやしいので訂正します。もうすこし検証してみようと思います。 → 検証して fluentd側の設定の問題であることが分かりました。詳しくは、http://blog.stanaka.org/entry/2013/02/22/171053 追記ここまで 最近は、fluentd + mongodb でログを蓄積していろいろ便利に使っているわけですが、数分に一回集計スクリプトを周したり、 GrowthForecast の画面をリロードしまくるのではなく、もっとリアルタイムで見たい! という欲求が募ってきたので、 node.js を使って実装してみました。( https://github.com/stanaka/realti
普通の JavaScript も jQuery もまともに書けないけど、はじめての Web アプリを Node.js でつくってみるという奮闘記。 環境つくるだけなのに何も分からなすぎてハマりすぎて、この一連の流れだけで丸 2 日潰れるという大惨事だったので、ちゃんとブログに残しておく。 Node.js のインストール Node.js の INSTALL ボタンから、インストーラを使って入れることもできるけど、Node.js のバージョンを切り替えて使える方が便利だと思うので、前回のエントリを参考に nodebrew を使ってインストールするのがオススメ。 node.js 入れるなら nodebrew が超簡単 - tacamy memo インストールが正しくできているか確認のため、Node.js のバージョンを表示。 $ node -v npm のインストール Node.js にはたくさ
node-chromeはnode.jsをバックエンドに、フロントエンドをChromeを使ってローカルアプリケーションを開発します。 node.jsを使っていると何でもJavaScriptで完結したい気分になってきます。そこでターゲットになるのがローカルアプリケーションです。Gtkなどを使うことなく、何とChromeを使ってしまうソフトウェアがnode-chromeです。 デモアプリを立ち上げたところ。 デモのコードです。 node-chromeではGoogle Chromeのパスを指定し、普段使っているプロセスとは別でWebブラウザを立ち上げます。後はnode.jsのサーバとして動くのみです。ローカルでWebアプリケーションを立ち上げて利用するという新しいスタイルが実現しそうです。 node-chromeはnode.js製のソフトウェア(ソースコードは公開されていますがライセンスは明記され
はじめに 先日、PhantomJS でログインが必要なページでも自由自在にスクレイピング - 凹みTips という記事を書きました。 前回は PhantomJS のみを用いてスクレイピングを行なっていましたが、スクレイピングした結果を使って色々やりたい!となると、Node.js の力を借りたくなってきます。単純に取得した HTML を利用するだけなら、PhantomJS の fs モジュールを使って HTML をファイルに書き出し、これを Node.js で読み取って…、なんてことをすれば可能ですが、何かしらの入力を受けて動的にページを遷移したい、となると厳しくなってきます。 そこで、本エントリでは PhantomJS を Node.js から使って色々出来るよ!ということを解説したいと思います。 利用するモジュール PhantomJS をラップした Node モジュールは沢山あります。試
どう? 蕎麦の巻き方の練習してる? ずるってる? どうもマコピーです。最近はふぐおじさんになったりフードファイターにされそうになったり大変です。 さて、このAdvent Calendarですが、着々とクリスマスに向かって続々と記事が書かれていってあと11日。 さきほど所用で街に出かけましたが、なるほど、世間はクリスマス色ですね、つらぽよ。 つらいし誰もかまってくれないし、@hisaichi5518くんには「めんどくせぇ!」って言われるし、外も寒くなってきたので、一人でもさみしくないようにIRCのボットを作ってみようと思います。 とはいえ、IRCのボットで彼女を作るとか二番煎じもいいところなので、そういうことはしません。 淡々とボットを作ってなんとかイノベーションに紐づけてみようと思います。 hubotって HUBOT CoffeeScriptで作られたボットのフレームワークです。node.
node.js側の実装 Node.jsのAPIだけでやってます。 PHPをコマンドラインで呼び出します。 var util = require('util'); var spawn = require('child_process').spawn; var php = spawn('php', ['callme.php']); // $ php callme.php と同じ意味 var data = { 'foo': 'something', 'bar': 'something', }; php.stdin.write(JSON.stringify(data)); // 標準入力としてPHPに渡す php.stdin.end(); // PHPさん、標準入力終わったよ php.stdout.on('data', function (data) { console.log('stdout:
http://keima.herokuapp.com/ 「えーpolling!? pollingが許されるのは小学生までだよねー、キャハハハ」というわけでpush通知にWebSocketをお使いのみなさま、こんにちは。 しかし、毎回、WebSocketを扱う機能を実装するのは、いくつかの理由で面倒ですよね! WebSocketは様々なバージョンがあるので、すべてに対応するのは面倒。 同様の理由で、個別のアプリで作り込んでしまうと、WebSocketのバージョンアップに追従するのが面倒。 WebSocketは大抵別サーバになっているので、設定が面倒。 Heroku等のPaaSではWebSocketを使えないことが多い。 (2015/1/23追記: HerokuはWebSocketをサポートするようになりました) そこで、WebSocketによるpush通知に特化したWebサービス Keima
Balloons.IOはnode.js+Redisで作られたWebチャットサーバです。 node.jsを使ったWebアプリケーションとしてよく取り上げられるのがWebチャットではないでしょうか。WebSocketsとノンブロッキングなnode.jsの特徴を引き出したサービスです。そんなWebチャットを自分でも立ててみたいと思ったらBalloons.IOを使ってみましょう。 トップページです。認証はTwitterを利用します。 ログインしました。ついで部屋を作成します。 チャット画面です。 アイコンが表示されていませんが会話は出来ます。 日本語も特に問題なく使えます。 Balloons.IOはnode.js + Socket.io + Redisの組み合わせで実装されています。さらにTwitterによるOAuth認証も使われており、WebフレームワークにExpressを利用するなど今時の技術
準備node.jsでMIDIを拾うには、node-midiを使います。RtMidiというOSごとの差異をうめるライブラリを呼び出しているので、MacでもLinuxでも、もちろんWindowsでも大丈夫なようす。npmにはもうひとつPure JSでMIDIを扱えるものがありますが、こっちはサンプルを見たところLinux依存のようです。 MIDI信号をひろうとりあえずサンプルのとおりに。 var midi = require('midi'); var input = new midi.input(); // MIDI INの信号を拾ったら実行する input.on('message', function(deltaTime, message) { console.log('m:' + message + ' d:' + deltaTime); }); // ポートを読み始める input.op
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く