kisaragi 0.2.0
Realtime Web service framework きさらぎ(kisaragi)
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Realtime web framework きさらぎ(kisaragi)
What is きさらぎ
Websocket等を用いてリアルタイムな処理を行うWebサービスを作るためのフレームワークです
Now version
ver0.2.0 code:ことり(kotori) released at 2017 Dec 30
Sample
sample_command.d
import kisaragi;
import std.algorithm;
class SampleCommand : Command
{
/*
* will be executed proc() by receiving {"command":"sample" ... } json message
*/
override @property public string name()
{
return "sample";
}
override public void proc(Event eve)
{
string message = eve.json["message"].get!string;
eve.sender.send(message); // ping-pong
eve.clients.each!((client)=>{client.send(message)}); // broadcast to be connected client
}
}
main.d
import kisaragi;
import sample_command;
int main()
{
auto kisaragi = new Kisaragi;
kisaragi.addCommand(new SampleCommand);
kisaragi.setting = new Setting; // see kisaragi.setting
return kisaragi.run; // in default settings, will start server on 0.0.0.0:80 and ::1:80
}
ライセンス
AGPL-3.0です。 GitHub上でのforkはもちろん、別の方法でのforkも大歓迎です。
- 0.2.0 released 7 years ago
- kiridaruma/kisaragi
- AGPL-3.0
- Copyright © 2017, kiridaruma
- Authors:
- Dependencies:
- vibe-d
- Versions:
-
0.2.0 2017-Dec-30 0.1.0 2017-Dec-28 ~master 2017-Dec-30 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
20 downloads total
-
- Score:
- 0.0
- Short URL:
- kisaragi.dub.pm