{"id":15056439,"url":"https://github.com/zgbjgg/evews","last_synced_at":"2025-04-10T04:10:38.148Z","repository":{"id":7875954,"uuid":"9249613","full_name":"zgbjgg/evews","owner":"zgbjgg","description":"Evews - Erlang Lightweigth Websocket RFC 6455","archived":false,"fork":false,"pushed_at":"2019-11-27T17:19:29.000Z","size":1077,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T11:12:24.166Z","etag":null,"topics":["erlang","lightweight","rfc-6455","websocket"],"latest_commit_sha":null,"homepage":"https://github.com/zgbjgg/evews","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zgbjgg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-05T20:08:56.000Z","updated_at":"2019-11-27T17:19:31.000Z","dependencies_parsed_at":"2022-08-28T16:10:33.670Z","dependency_job_id":null,"html_url":"https://github.com/zgbjgg/evews","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fevews","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fevews/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fevews/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Fevews/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zgbjgg","download_url":"https://codeload.github.com/zgbjgg/evews/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154986,"owners_count":21056543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erlang","lightweight","rfc-6455","websocket"],"created_at":"2024-09-24T21:51:29.281Z","updated_at":"2025-04-10T04:10:38.131Z","avatar_url":"https://github.com/zgbjgg.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"evews\n=====\n\nevews - Lightweight Websocket RFC 6455 - v1.9\n\n[![Hex.pm](https://img.shields.io/hexpm/v/evews.svg)](https://hex.pm/packages/evews)\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![Hex.pm](https://img.shields.io/hexpm/dt/evews.svg)](https://hex.pm/packages/evews)\n[![Hex.pm](https://img.shields.io/hexpm/dw/evews.svg)](https://hex.pm/packages/evews)\n\ndownload \u0026 build\n====\n\nClone the evews repo:\n\n\t$ git clone https://github.com/jorgegarrido/evews.git\n\t\t\nTo compile you will need 'rebar', with debug logging enabled:\n\n\t$ make debug=on compile\n\nOr without debug (option for not create a long messages in the logs)\n\n\t$ make compile\n\n\nstart\n====\n\nTo start the evews websocket server just add the ebin/ path, process that controls the sokcte is designed as a \nnon-blocking socket (tcp/ssl) to accept many concurrents connections at the same time, to start supervisor, it \nneeds the next args:\n\n\t* Port \t   - the port where websocket runs\n\t* Ws Handler - the module and function that manages the websocket (as a callback module), here you can receive \u0026 send messages\n\t* Ssl\t   - Certfile, Keyfile and password (if any)\n\t\t\nthis is a simple example how to start evews websocket server on port 8081 and the callback module example:loop/1 :\n\n```erlang\nevews_sup:start_link([{port, 8081}, {ws_handler, [{callback_m, example}, {callback_f, loop}]}]).\n```\n\nthe callback module 'example' must have a function named loop which receives one parameter, a tuple with the websocket\nmodule and the record with the info about it, and this function is a simple process that receives messages from the broswer with the tuple '{browser, Data}', callback module function looks like this:\n\n```erlang\nloop({Ws, WsInfo}) -\u003e\n  receive\n    {browser, Data} -\u003e\n      io:format(\"receive ~p\\n\", [Ws:get(Data)]),\n      loop({Ws, WsInfo});\n    Any -\u003e\n      io:format(\"any ~p\\n\", [Any]),\n      loop(Ws)\n    after 1000 -\u003e\n      Ws:send([\"echo!\"]),\n      loop({Ws, WsInfo})\nend.\n```\n\ncheck the [evews_example.erl](https://github.com/jorgegarrido/evews/blob/master/examples/evews_example.erl) module for more info\n\nexports\n======\n\n\u003e NOTE Evews is no longer managed by a parametrized module.\n\nEvews Websocket can retrieve info about connection, WsInfo is present on your callback module and is used on each function, the next are the options in Ws:\n\n\n\t\tWs:get(Data)\n\t\tGets the message\n\n\t\tWs:send(Msg, WsInfo)\n\t\tSends the message to the browser, Msg can be a string or iolist\n\n\t\tWs:socket(WsInfo)\n\t\tReturns the port for this socket\n\n\t\tWs:peername(WsInfo)\n\t\tReturns the address and port for the other end of a connection\n\n\t\tWs:port(WsInfo)\n\t\tReturns the local port number of this socket\n\n\t\tWs:sockname(WsInfo)\n\t\tReturns the local address and port number of this socket.\n\t\t\nLICENSE\n======\n\nTHIS SOFTWARE IS LICENSED UNDER BSD LICENSE. see LICENSE.txt for more info\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgbjgg%2Fevews","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzgbjgg%2Fevews","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgbjgg%2Fevews/lists"}