Questions tagged [cowboy]

Cowboy is a small, fast and modular HTTP server written in Erlang. Cowboy is also a socket acceptor pool, able to accept connections for any kind of TCP protocol.

Cowboy is a small, fast and modular HTTP server written in Erlang. Cowboy is also a socket acceptor pool, able to accept connections for any kind of TCP protocol.

https://github.com/extend/cowboy/

248 questions
31
votes
3 answers

Start Phoenix app with cowboy server on different port

Is it possible to start locally a few Phoenix apps on different ports from the console using some command like mix phoenix.server --port=4001? This one does not work, of course, but, maybe, there is similar way.
kovpack
  • 4,905
  • 8
  • 38
  • 55
24
votes
1 answer

How can I know if the message sent by websocket success or not

I developed a chat server using websocket in cowboy, but I want to know if the message sent by server to client success.How can I know?
ter
  • 289
  • 1
  • 3
  • 6
11
votes
3 answers

How to configure the Plug.Static without Phoenix

I am trying to figure out how to configure Plug.Static without any other framework (Phoenix, Sugar, etc); just Cowboy, Plug and Elixir. I just don't know how to put things together in the Router. plug :match plug Plug.Static, at: "/pub", from:…
mszmurlo
  • 1,250
  • 1
  • 13
  • 28
11
votes
4 answers

Enabling CORS for Cowboy REST API

How can I enable CORS for cowboy rest handler? I tried to add options/2 method, like this: options(Req, State) -> {[ {<<"access-control-allow-origin">>, <<"*">>}, {<<"access-control-allow-methods">>, <<"GET, OPTIONS">>} ],…
couchemar
  • 1,927
  • 19
  • 22
10
votes
4 answers

What replaces the MVC pattern in functional programming?

I'm a MVC web developer who's become very interested in functional programming to write web apps (specifically, I'm captivated by Erlang and Cowboy.) What I'm having trouble finding an answer to/resources on is what pattern is used to replace MVC in…
iliveinapark
  • 327
  • 4
  • 13
9
votes
1 answer

how to setup cowboy with rebar3

I am a newbie of erlang/cowboy, using rebar3 now, as 99's cowboy is using its own erlang.mk system, how can I use rebar3 to build a cowboy release? Thank you in advance.
perigee
  • 9,438
  • 11
  • 31
  • 35
9
votes
2 answers

SPDY in Phoenix

I know that Cowboy is capable of handling SPDY protocol (not HTTP2, though). However, looking into Phoenix framework source code, I only see http and https calls. Is SPDY ignored? It's pity to have my Elixir/Phoenix site serves pages slower than its…
Damir Bulic
  • 2,209
  • 1
  • 15
  • 7
8
votes
2 answers

How to get http params from Cowboy?

I am using cowboy( https://github.com/extend/cowboy) for one restful web service, I need to get the params from "http://localhost:8080/?a=1&b=2&c=32" init({tcp, http}, Req, Opts) -> log4erl:debug("~p~n", [Opts]), {ok, Req,…
why
  • 23,923
  • 29
  • 97
  • 142
7
votes
3 answers

Sending binary data over websocket with cowboy and MessagePack

I'm trying to send a MessagePack-encoded message from Cowboy to a browser over WebSocket, and received data is always empty or invalid. I'm able to send binary data from JS to my cowboy handler, but not vice versa. I'm using Cowboy 1.0.4 with…
6
votes
1 answer

In a Phoenix application, what is the difference between the :port key of the :http and :url configurations?

I'm currently working in a Phoenix app and had this question when modifying my /config/* files. Currently the configuration for my Endpoint contains the following: config :my_app, MyApp.Endpoint, http: [port: 8080], url: [host: "example.com",…
Daniel Zendejas
  • 466
  • 3
  • 14
6
votes
1 answer

Error when trying to send HTTP status code in Phoenix

I am a Phoenix/Elixir beginner and am trying to write an API to allow users to sign up in my application. The API endpoint works as expected unless I try to set the HTTP status code of the response. When I include lines A, B and C (indicated in the…
6
votes
2 answers

Serving HTTP range request with phoenix?

I'm currently developing a website with phoenix and have a video section that should play in the background. Although it works fine on Chrome & Firefox, it does not work on Safari. I suspect it is because cowboy is not serving HTTP range-request…
TheSquad
  • 7,385
  • 8
  • 40
  • 79
5
votes
2 answers

How do I send data asynchronously over a websocket with Cowboy?

I have a Cowboy websocket server and I'd like to register a gen_event handler that sends something over the websocket. I also need to be able to reply to regular synchronous requests with websocket_handle/3. I didn't see anything obvious in…
nmichaels
  • 49,466
  • 12
  • 107
  • 135
5
votes
1 answer

Why does the Pry shell timeout so quickly in Phoenix/cowboy? (shell process exited with reason: shutdown)

When I use IEx.pry or a breakpoint (via :int.break()), the interactive shell dies too quickly, and I only have ~10 seconds before I lose my session: ** (EXIT from #PID<0.606.0>) shell process exited with reason: shutdown And 10 seconds isn’t enough…
montooner
  • 1,112
  • 4
  • 17
  • 29
5
votes
1 answer

Erlang Cowboy - Dependency crypto is specified as a dependency but is not reachable by the system

I have installed Erlang vesion 19.3 on CentOS 7 linux server. Yesterday, I downloaded Cowboy HTTP server (latest version). In the examples/hello_world directory I have run make (version 4.1) command and got the following error Dependency crypto is…
Paramore
  • 1,313
  • 2
  • 19
  • 37
1
2 3
16 17