cowboy

Why is my cowboy server not running?

走远了吗. 提交于 2019-12-12 01:22:52
问题 I'm trying to run my server. I copied my src files into a fresh cowboy install, this is the error I'm getting. ~/cowboy_ninja:.ls src action_handler.erl gate.beam resolution.beam arena.beam gate.erl resolution.erl arena.erl guestbook.beam temple.beam cowboy_ninja_app.erl guestbook.erl temple.erl cowboy_ninja_sup.erl hello_handler.erl ~/cowboy_ninja:. cat src/cowboy_ninja_app.erl -module(cowboy_ninja_app). -behaviour(application). -export([start/2]). -export([stop/1]). start(_Type, _Args) ->

Simple chat system over websockets with reconnection feature

偶尔善良 提交于 2019-12-10 23:44:25
问题 I have seen many examples of chat room systems over websocket implemented with erlang and cowboy. Most of the examples I have seen use gproc. In practice each websocket handler registers itself with gproc and then broadcasts/receives messages from it. Since a user could close by accident the webpage I am thinking about connecting to the websocket handler a gen_fsm which actually broadcasts/receives all the messages from gproc. In this way the gen_fsm could switch from a "connected" state to a

Bad value on output port 'tcp_inet'

六月ゝ 毕业季﹏ 提交于 2019-12-10 16:06:20
问题 I'm using the Phoenix framework, which is running Cowboy underneath. I am occasionally seeing the following pair of errors in my log: Bad value on output port 'tcp_inet' GenServer #PID<0.8423.1> terminating ** (FunctionClauseError) no function clause matching in :http_transport.close/2 (inets) http_transport.erl:346: :http_transport.close(:undefined, #Port<0.18079778>) (stdlib) gen_server.erl:643: :gen_server.try_terminate/3 (stdlib) gen_server.erl:809: :gen_server.terminate/7 (stdlib) proc

Cowboy的使用

这一生的挚爱 提交于 2019-12-10 08:30:43
使用rebar3创建erlang项目 rebar3 new app test_cowboy 修改rebar.config {plugins, [ {rebar3_run, {git, "git://github.com/tsloughter/rebar3_run.git", {branch, "master"}}} ]}. {erl_opts, [debug_info]}. {deps, [ {cowboy, {git, "git://github.com/extend/cowboy.git",{tag, "1.0.0"}}} ]}. {relx, [{release, {test_cowboy, "1.0.0"}, [test_cowboy]}, {dev_mode, false}, {include_erts, true}, {system_libs, true}, {include_src, false}, {sys_config, "conf/sys.config"}, {vm_args, "conf/vm.args"}, {extended_start_script, true} ]}. 创建conf文件夹 mkdir conf && cd conf 在conf下创建vm.args和sys.config文件 vm.args ## Name of the node

Rebar3 + Cowboy Kernel PID Terminated

别说谁变了你拦得住时间么 提交于 2019-12-04 06:10:08
问题 I installed rebar3 and created a new release with cd ~/apps rebar3 new release tunnel Then I copied my src files from ~/tunnel/src/* to ~/apps/tunnel/src/ I ran into a compile error with rebar3 run and found Erlang "Kernel pid terminated" error as a possible solution. I renamed everything about tunnel_app to tunnel . So my src contains tunnel.erl , tunnel.app.src and tunnel_sup.erl . I renamed the module definition as appropriate. Here's the rebar3 run error: ~/apps/tunnel:.rebar3 run ===>

Elixir stream to all subscribers

雨燕双飞 提交于 2019-12-04 05:51:13
问题 I'm trying to implement a radio server in Elixir One process is always working and reading a file (mp3) and publish to topic ":radio", currently for test purpose when it finishes it starts over Each connection subscribes to topic ":radio" I don't understand how to send the chunks to all subscribed connections, the connection closed after 2 or 3 chunks defmodule Plugtest do import Plug.Conn def init(opts), do: opts def start() do Plug.Adapters.Cowboy.http(Plugtest, []) {:ok, _pid} = PubSub

Elixir stream to all subscribers

我只是一个虾纸丫 提交于 2019-12-02 10:13:10
I'm trying to implement a radio server in Elixir One process is always working and reading a file (mp3) and publish to topic ":radio", currently for test purpose when it finishes it starts over Each connection subscribes to topic ":radio" I don't understand how to send the chunks to all subscribed connections, the connection closed after 2 or 3 chunks defmodule Plugtest do import Plug.Conn def init(opts), do: opts def start() do Plug.Adapters.Cowboy.http(Plugtest, []) {:ok, _pid} = PubSub.start_link() spawn(fn -> stream_from_file("./song.mp3", 128) end) end def call(conn, _opts) do conn = conn

Facing intermittent 404 issue when calling Rails API

会有一股神秘感。 提交于 2019-12-02 04:21:36
I have banged my head on this for 2 days now and i dint find any luck yet. Looking for help on this. The issue: Front End makes 10 similar XHR requests ( for different users ) to my Rails API and few of the requests randomly fails with 404 status code. My Observations: If i make the same request again, It passes. I dont see any trace of 404 requests even hitting my server ( using logs ). I do see different response headers for 200 and 404 ( mentioned below ) and i see cowboy ( https://github.com/heroku/cowboyku , https://github.com/heroku/vegur ) server for 404 requests. I run my rails

How do you use Gun as a Cowboy client?

隐身守侯 提交于 2019-12-02 01:18:19
问题 I followed the Getting Started instructions for Cowboy, and I've got Cowboy running and listening on port 8080, and I got the Hello Erlang! response when I entered http://localhost:8080 in my browser. Now, how do I use Gun to connect to Cowboy? I read the Gun docs, and it says to add "Gun as an erlang.mk dependency". So I downloaded erlang.mk: ~/erlang_programs/my_gun$ curl -O https://erlang.mk/erlang.mk and following the Erlang.mk User Guide, I created an application: ~/erlang_programs/my

How do you use Gun as a Cowboy client?

半腔热情 提交于 2019-12-01 20:43:49
I followed the Getting Started instructions for Cowboy, and I've got Cowboy running and listening on port 8080, and I got the Hello Erlang! response when I entered http://localhost:8080 in my browser. Now, how do I use Gun to connect to Cowboy? I read the Gun docs , and it says to add "Gun as an erlang.mk dependency". So I downloaded erlang.mk: ~/erlang_programs/my_gun$ curl -O https://erlang.mk/erlang.mk and following the Erlang.mk User Guide , I created an application: ~/erlang_programs/my_gun$ gmake -f erlang.mk bootstrap Then I added gun as a dependency to the Makefile: PROJECT = my_gun