You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
なんどか紹介しているPython製軽量WEB鯖Bottleで、Websocketを扱う方法です。 実際のところ 環境導入 $ pip install bottle-websocket サンプル実行 公式提供のサンプルはgithubにあります。 実行には別途、geventという並行処理系ライブラリが必要です。 $ pip install gevent $ pip install gevent-websocketまず、python。 "echo.py" from bottle import get, run, template from bottle.ext.websocket import GeventWebSocketServer from bottle.ext.websocket import websocket @get('/') def index(): return templat
WebSocket も RFC6455 になってからは何時の時点の仕様で相互接続性があーだこーだと悩む必要がなくなったから、だいぶ使いやすくなった気がする。 今回は Python の gevent-websocket を Flask と一緒に使って WebSocket を試してみる。 これは、その名の通り Gevent をベースにした WebSocket ライブラリだ。 インストールは PyPI から PIP を使う。 $ pip install gevent-websocket flask 早速サンプルプログラム。 内容はユーザからの入力を単純にエコーバックするというもの。 接続するエンドポイントは ws://localhost:5000/echo になる。 #!/usr/bin/env python # -*- coding: utf-8 -*- from geventwebsocke
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く