diff --git a/examples/blog/bin/console b/examples/blog/bin/console new file mode 100755 index 0000000..98698b6 --- /dev/null +++ b/examples/blog/bin/console @@ -0,0 +1,4 @@ +require_relative '../app' +require 'prism' + +Prism::Cli.new(__dir__).console(['--prompt=blog> ']) diff --git a/examples/blog/bin/server b/examples/blog/bin/server index 7386e59..e466f89 100755 --- a/examples/blog/bin/server +++ b/examples/blog/bin/server @@ -1,6 +1,18 @@ require_relative '../app' -server = Prism::Server.new(Blog, port: (ARGV[0] || 3000).to_i).start +# A hard cap on the total number of live WebSocket connections this +# process will hold open at once (across every post's /cable stream +# combined), distinct from PostActivityChannel::MAX_VIEWERS_PER_POST which +# only bounds a single stream - without this, enough popular posts could +# still exhaust the process's file descriptors even though no individual +# post ever hits its own per-stream limit. +MAX_WEBSOCKET_CONNECTIONS = 2000 + +server = Prism::Server.new( + Blog, + port: (ARGV[0] || 3000).to_i, + max_websocket_connections: MAX_WEBSOCKET_CONNECTIONS +).start puts "listening on #{server.url}" trap('INT') { server.stop; exit } sleep