Giter Club home page Giter Club logo

n2o's Introduction

N2O: TCP MQTT WebSocket

Actions Status Build Status Hex pm

N2O is an embeddable message protocol loop library for WebSocket, HTTP, MQTT and TCP servers. It provides basic features, such as process management, virtual nodes ring for request processing, sessions, frame encoding, and unified API for external mq and caching services.

Core Features

  • Purpose: High performance protocol relay
  • Endpoints: WebSockets, MQTT, TCP
  • Codebase: 700 LOC (Erlang), 500 LOC (JavaScript)
  • Dialyzer: REBAR, REBAR3, MAD, MIX
  • Hosts: COWBOY, EMQ, MOCHIWEB, RING, TCP, UDP
  • PubSub: GPROC, SYN, PG2
  • Formatters: JSON, BERT, ASN.1

Protocol Extensions

  • Templates: DTL, NITRO
  • Abstract Database Layer KVS: FS, MNESIA, ROCKSDB, RIAK, REDIS
  • Business Processes: BPE (BPMN 2.0), SCM, ERP, CRM
  • HTTP API: REST (proplist/JSON)
  • ACTIVE Reloading: GNU/Linux, Windows, macOS

Basic Samples

Enterprise Samples

  • Online Client Bank: BANK (8041)
  • Instant Messaging: CHAT (8042)
  • Product Lifecycle Management: PLM (8043)

Motivation

N2O was created to bring clarity and sanity to software development. The distribution model is per file basis with ISC license.

Kernel

The core modules provide OTP start and N2O entry point.

MQTT

MQTT version is implemented as RPC over MQ pattern. N2O service worker started as ring of virtual nodes each runs N2O loop.

mad app zero review
cd review
mad dep com pla rep
open http://127.0.0.1:8000

WebSocket

N2O Loop is directly connected and ran inside context of WebSocket handler. Usually in Erlang we use syn or gproc OTP message buses. As such buses are optional in MQTT setup we include bus drivers in WebSocket package.

mad app nitro sample
cd sample
mad dep com pla rep
open https://127.0.0.1:8001/app/index.htm

Protocols

N2O ships with 3 optional protocols.

Services

Formatters, Sessions, etc. Optional.

JavaScript

Literature

  • "N2O: no bullshit sane framework for wild web" PDF (versions 0.11—4.4)
  • "N2O BOOK Vol.2 Green Book" HTML (versions 4.5—9.11)

n2o's People

Contributors

221v avatar 23min avatar 5ht avatar alfua avatar am-kantox avatar antonlogvinenko avatar b0oh avatar cryoflamer avatar doxtop avatar fxmy avatar g-grand avatar gmixo avatar kianmeng avatar m-2k avatar mamsw avatar mamusr avatar moiseev avatar oniry avatar osbre avatar pal-alex avatar proger avatar rilian avatar romanshestakov avatar sinasamavati avatar soyayaos avatar sunrisegg avatar surik avatar umka1332 avatar xafizoff avatar zatolokinpavel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

n2o's Issues

Bert и атомы

Меня всегда с Bert интересовал один момент: как избежать передачи атомов в пакете? А точнее при декодировании пакета.
Дело в том что в n2o_websocket ты используешь binary_to_term(Info).
Если передать в Info атом, то он успешно декодируется и останется в памяти Erlang VM до перезагрузки.
Получается очень легко организовать DOS атаку по памяти.
Есть ли защита от этого или хотябы идеи как избежать ?

element_datepicker_textbox

Джентельмены, у Вас тут какая-то фигня написана.

Script = wf:f("jQuery($('#~s').datepicker(~s);", [Anchor, Options]),

На нее javascript console ругается. Я её заменил на

Script = wf:f("$('#~s').datepicker(~s);", [Anchor, Options]),

Но так и не понял, что Вы хотели этим сказать.

Для корректной работы надо добавить в проект bootstrap-datepicker.css & bootstrap-datepicker.js. В конце своей страницы выполнить скрипт

<<"$('.datepicker_textbox').datepicker();">>.

Я это сделал подстановкой в шаблон страницы куска со скриптами в дополнение к title, body.

Can I let N2O support web socket request from iOS or android client?

I'm so sorry that I know this isn't a really code issue, but I can't find other community for N2O.
I'm working for a project needing iOS and android client, and I want to use N2o to build a backend service. Of course, there is a web client too.

I'm finding a solution for integrating the web, iOS and android, and erlang/N2O.
I think to use websocket is a good idea, isn't it ?

But how can I do it ?
Is there some example code for N2O?

Thanks a lot !

https (wss) in n2o?

Hello, I hope this is the right place to ask this question.
Does n2o support https, hence secure websockets? I tried to switch to https in my app, but the server won't try protocol upgrade (page is rendered and then no events/actions work).

#event problem

I got a error:

=ERROR REPORT==== 17-Aug-2014::19:27:05 ===
Error in process <0.5205.0> with exit value: {[{reason,badarg},{mfa,{bullet_hand"],[]},{wf,log,4,[{file,"/Users/homeway/erlang/n2o/samples/deps/n2o/src/wf.erl"},{line,160}]},{n2o_bullet,terminate,2,[{file...

Is there any problem in follow code?

-module(about).
-compile(export_all).
-include_lib("n2o/include/wf.hrl").

title() -> [ <<"About">> ].
main() -> #dtl{file = "index", app=n2o_sample,bindings=[{title,title()},{body,body()}]}.

body() ->
wf:wire(#event {target=mybutton, type=click, postback=myalert}),
[#button { id=mybutton, body="Submit" }].

event(myalert) ->
wf:info(?MODULE, "event info", []),
wf:wire(#alert{text = "my alert"});
event(Unkown)->
wf:info(?MODULE, Unkown, []).

element_checkbox.erl

Hi,

I tried the following

checkbox{id=admin, checked=Admin, body= <<"Administrator">>},

button{ body = <<"Save">>, postback = save,source = [name,password,admin]}

but wf:q(admin) always equals 'on' - the default value whether it is checked or not. My first attempt to correct this was:

panel{id="check_" ++Id, body=[#checkbox{id=admin, checked=Admin, value=Admin, body= <<"Administrator">>, postback={setvalue,admin,not Admin}}]}

and then to handle the postback

event({setvalue,Id,Val}) ->
    wf:update("check_" ++ Id, #panel{id= "check_" ++ Id, body=[#checkbox{id=Id,\
 checked=Val, body=Id, postback={setvalue,Id,not Val}, value=Val}]});

while it worked, it seems overly complex. Then I modified action_event.erl to

render_action(#event{postback=Postback,actions=Actions,source=Source,target=Control,
                                   type=Type,delegate=Delegate}) ->
    Data = "[" ++ string:join([begin
        {Key, Id} = if  is_atom(Src)-> S = atom_to_list(Src),
                        {"atom('"++S++"')", S};
                    true -> {"utf8.toByteArray('" ++ Src ++ "')", Src} end,
        "tuple(" ++ Key ++ ", document.querySelector('#" ++ Id ++ "').type == 'checkbox' ?
          utf8.toByteArray(document.querySelector('#" ++ Id ++ "').checked.toString()) :  
           utf8.toByteArray(document.querySelector('#"  ++ Id ++ "').value))" end || Src <- Source]
       ++ ["tuple(tuple(utf8.toByteArray('"++ Control ++"'), bin('detail')), event.detail)"],",") ++ "]",
    PostbackBin = wf_event:new(Postback, Control, Delegate, event, Data),
    [wf:f("document.querySelector('#~s').addEventListener('~s',function (event) {", [Control,Type]),PostbackBin,"});"].

Basically testing if the element is a checkbox, and returning the value of 'checked' instead of 'value'. This implements the behaviour I was expecting for the checkbox. Am I missing something on the checkboxes?

Thanks, Stephen

Can't start auto compiler on my mac now :(

=ERROR REPORT==== 17-Aug-2014::08:58:16 ===
driver_select(0x000000001a9c00a0, 0, ERL_DRV_READ ERL_DRV_USE, 1) by tty_sl (tty_sl -c -e) driver #Port<0.63512> stealing control of fd=0 from input driver fd (0/1) #Port<0.420>

Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.1 (abort with ^G)
1>
=INFO REPORT==== 17-Aug-2014::08:58:17 ===
application: fs
exited: {
{shutdown,
{failed_to_start_child,fs_server,
{enoent,
[{erlang,open_port,
[{spawn_executable,"deps/fs/priv/mac_listener"},
[stream,exit_status,
{line,16384},
{args,[
"-F",
"/Users/homeway/erlang/n2o/homeway-fork/n2o/samples"]},
{cd,"/Users/homeway/erlang/n2o/homeway-fork/n2o/samples"}]],
[]
},
{fsevents,start_port,2,
[{file,
"/Users/homeway/erlang/n2o/homeway-fork/n2o/samples/deps/fs/src/sys/fsevents.erl"},
{line,12}]
},
{fs_server,init,1,
[{file,
"/Users/homeway/erlang/n2o/homeway-fork/n2o/samples/deps/fs/src/fs_server.erl"},
{line,11}]
},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},
{line,239}]}]}}},
{fs_app,start,[normal,[]]}
}
type: temporary

jsonx: windows build fails

Latest n2o, fresh rebar, windows 7 64-bit, visual studio express 2012

==> jsonx (compile)
Compiled src/jstream.erl
Compiled src/jsonx.erl
Compiling c:/dev/n2o/deps/jsonx/c_src/jsonx.c
Оптимизирующий компилятор Microsoft (R) C/C++ версии 17.00.50727.1 для x64
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

jsonx.c
c:\PROGRA~1\ERL510~1.1\erts-5.10.1\include\erl_nif.h(105) : warning C4820: <unna
med-tag>: "4"-байтовые поля добавлены после данные-член "arity"
c:\PROGRA~1\ERL510~1.1\erts-5.10.1\include\erl_nif.h(114) : warning C4820: enif_
entry_t: "4"-байтовые поля добавлены после данные-член "num_of_funcs"
c:\dev\n2o\deps\jsonx\c_src\jsonx.h(79) : error C2036: void *: неизвестный разме
р
c:\dev\n2o\deps\jsonx\c_src\jsonx.h(84) : error C2036: void *: неизвестный разме
р
c:\dev\n2o\deps\jsonx\c_src\jsonx.h(127) : warning C4018: <: несоответствие типо
в со знаком и без знака
c:\dev\n2o\deps\jsonx\c_src\jsonx.h(149) : error C2036: void *: неизвестный разм
ер
c:\dev\n2o\deps\jsonx\c_src\jsonx.h(159) : error C2036: void *: неизвестный разм
ер
c:\dev\n2o\deps\jsonx\c_src\jsonx.h(169) : error C2036: void *: неизвестный разм
ер
c:\dev\n2o\deps\jsonx\c_src\jsonx.h(179) : error C2036: void *: неизвестный разм
ер
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(74) : error C2143: синтаксическая ошибка: от
сутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(75) : error C2143: синтаксическая ошибка: от
сутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : error C2275: EncEntry: недопустимое ис
пользование этого типа в качестве выражения
        c:\dev\n2o\deps\jsonx\c_src\jsonx.h(75): см. объявление "EncEntry"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : error C2065: enc_entry: необъявленный
идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : error C2065: priv: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : error C2223: выражение слева от "->enc
oder_RSTYPE" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : error C2065: resource_sz: необъявленны
й идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : warning C4047: функция: "ErlNifResourc
eType *" отличается по уровням косвенного обращения от "int"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : warning C4024: функция по указателю: р
азличные типы для формального и фактического параметров 1
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(76) : error C2198: функция по указателю: сли
шком мало аргументов для вызова
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(78) : error C2065: enc_entry: необъявленный
идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(78) : error C2223: выражение слева от "->rec
ords_cnt" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(79) : error C2065: enc_entry: необъявленный
идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(79) : error C2223: выражение слева от "->fie
lds_cnt" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(80) : error C2065: enc_entry: необъявленный
идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(80) : error C2223: выражение слева от "->bin
" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(80) : error C2198: функция по указателю: сли
шком мало аргументов для вызова
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(83) : error C2275: ErlNifBinary: недопустимо
е использование этого типа в качестве выражения
        c:\PROGRA~1\ERL510~1.1\erts-5.10.1\include\erl_nif.h(132): см. объявлени
е "ErlNifBinary"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(83) : error C2146: синтаксическая ошибка: от
сутствие ";" перед идентификатором "ebin"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(83) : error C2065: ebin: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(83) : warning C4555: выражение не имеет резу
льтата; требуется выражение с побочным действием
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(84) : error C2065: ebin: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(84) : warning C4133: функция: несовместимые
типы - из "int *" в "ErlNifBinary *"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(85) : error C2065: enc_entry: необъявленный
идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(85) : error C2223: выражение слева от "->bin
" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(85) : error C2065: ebin: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(85) : error C2224: выражение слева от ".data
" должно иметь тип структуры или объединения
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(85) : error C2224: выражение слева от ".size
" должно иметь тип структуры или объединения
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(85) : error C2198: memcpy: слишком мало аргу
ментов для вызова
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(87) : error C2275: ERL_NIF_TERM: недопустимо
е использование этого типа в качестве выражения
        c:\PROGRA~1\ERL510~1.1\erts-5.10.1\include\erl_nif.h(94): см. объявление
 "ERL_NIF_TERM"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(87) : error C2146: синтаксическая ошибка: от
сутствие ";" перед идентификатором "list"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(87) : error C2065: list: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(87) : error C2065: head: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(87) : warning C4548: выражение перед запятой
 не имеет результата; требуется выражение с побочным действием
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(87) : error C2065: tail: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(88) : error C2065: list: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(88) : warning C4242: =: преобразование "cons
t ERL_NIF_TERM" в "int", возможна потеря данных
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(89) : error C2143: синтаксическая ошибка: от
сутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(90) : error C2065: list: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(90) : error C2065: head: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(90) : warning C4133: функция: несовместимые
типы - из "int *" в "ERL_NIF_TERM *"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(90) : error C2065: tail: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(94) : error C2065: head: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(95) : error C2143: синтаксическая ошибка: от
сутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(96) : error C2065: records: необъявленный ид
ентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(96) : error C2065: i: необъявленный идентифи
катор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(96) : error C2109: для индекса требуется мас
сив или указатель
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(98) : error C2065: records: необъявленный ид
ентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(98) : error C2065: i: необъявленный идентифи
катор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(98) : error C2109: для индекса требуется мас
сив или указатель
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(100) : error C2065: records: необъявленный и
дентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(100) : error C2065: i: необъявленный идентиф
икатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(100) : error C2109: для индекса требуется ма
ссив или указатель
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(101) : error C2065: i: необъявленный идентиф
икатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(102) : error C2065: list: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(102) : error C2065: tail: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(104) : error C2065: list: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(104) : warning C4242: =: преобразование "con
st ERL_NIF_TERM" в "int", возможна потеря данных
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(105) : error C2065: i: необъявленный идентиф
икатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(106) : error C2065: list: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(106) : error C2065: head: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(106) : warning C4133: функция: несовместимые
 типы - из "int *" в "ERL_NIF_TERM *"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(106) : error C2065: tail: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(110) : error C2065: head: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(111) : error C2143: синтаксическая ошибка: о
тсутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(113) : error C2065: fields: необъявленный ид
ентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(113) : error C2065: i: необъявленный идентиф
икатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(113) : error C2109: для индекса требуется ма
ссив или указатель
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(115) : error C2065: fields: необъявленный ид
ентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(115) : error C2065: i: необъявленный идентиф
икатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(115) : error C2109: для индекса требуется ма
ссив или указатель
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(116) : error C2065: i: необъявленный идентиф
икатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(117) : error C2065: list: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(117) : error C2065: tail: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(119) : error C2275: ERL_NIF_TERM: недопустим
ое использование этого типа в качестве выражения
        c:\PROGRA~1\ERL510~1.1\erts-5.10.1\include\erl_nif.h(94): см. объявление
 "ERL_NIF_TERM"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(119) : error C2146: синтаксическая ошибка: о
тсутствие ";" перед идентификатором "ret"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(119) : error C2065: ret: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(119) : error C2065: enc_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(119) : warning C4306: приведение типов: прео
бразование из "int" в "void *" большего размера
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(119) : warning C4242: =: преобразование "ERL
_NIF_TERM" в "int", возможна потеря данных
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(120) : error C2065: enc_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(120) : warning C4022: функция по указателю:
несоответствие указателя для фактического параметра 1
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(121) : error C2065: ret: необъявленный идент
ификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(123) : error C2065: enc_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(123) : warning C4022: функция по указателю:
несоответствие указателя для фактического параметра 1
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(134) : error C2143: синтаксическая ошибка: о
тсутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(135) : error C2143: синтаксическая ошибка: о
тсутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : error C2275: DecEntry: недопустимое и
спользование этого типа в качестве выражения
        c:\dev\n2o\deps\jsonx\c_src\jsonx.h(145): см. объявление "DecEntry"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : error C2065: dec_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : error C2065: priv: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : error C2223: выражение слева от "->de
coder_RSTYPE" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : error C2065: resource_sz: необъявленн
ый идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : warning C4047: функция: "ErlNifResour
ceType *" отличается по уровням косвенного обращения от "int"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : warning C4024: функция по указателю:
различные типы для формального и фактического параметров 1
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(136) : error C2198: функция по указателю: сл
ишком мало аргументов для вызова
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(138) : error C2065: dec_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(138) : error C2223: выражение слева от "->re
cords_cnt" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(139) : error C2065: dec_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(139) : error C2223: выражение слева от "->uk
eys_cnt" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(140) : error C2065: dec_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(140) : error C2223: выражение слева от "->ke
ys_cnt" должно указывать на структуру или объединение
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(142) : error C2275: ERL_NIF_TERM: недопустим
ое использование этого типа в качестве выражения
        c:\PROGRA~1\ERL510~1.1\erts-5.10.1\include\erl_nif.h(94): см. объявление
 "ERL_NIF_TERM"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(142) : error C2146: синтаксическая ошибка: о
тсутствие ";" перед идентификатором "list"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(142) : error C2065: list: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(142) : error C2065: head: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(142) : warning C4548: выражение перед запято
й не имеет результата; требуется выражение с побочным действием
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(142) : error C2065: tail: необъявленный иден
тификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(143) : error C2143: синтаксическая ошибка: о
тсутствие ";" перед "тип"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(144) : error C2275: ERL_NIF_TERM: недопустим
ое использование этого типа в качестве выражения
        c:\PROGRA~1\ERL510~1.1\erts-5.10.1\include\erl_nif.h(94): см. объявление
 "ERL_NIF_TERM"
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(144) : error C2065: ukeys: необъявленный иде
нтификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(144) : error C2065: dec_entry: необъявленный
 идентификатор
c:/dev/n2o/deps/jsonx/c_src/jsonx.c(144) : fatal error C1003: число ошибок превы
шает 100; остановка компиляции
ERROR: compile failed while processing c:/dev/n2o/deps/jsonx: rebar_abort

Duplicate elements on page using wf:insert_top / wf:insert_bottom in event(init)

In the browser creates two copies using functions to add items to the DOM.

True for the function wf:insert_top/2 and wf:insert_bottom/2 inside event(init):

%% table.erl
event(init) ->
    wf:insert(test,#span{body= wf:f("~p", [erlang:now()])}).
<!-- table.html template-->
<div id="test"></div>
%% routes.erl
route(<<"/table">>) -> table;
route(<<"/ws/table">>) -> table;

event-init

App name defaults to "web" ... documentation error?

Hi --

There's an assumption the definition of #dtl that the app name is "web". When it's not it fails with

{erlang,'++', [{error,bad_name},"/priv/templates/plain.html"], []},
{element_dtl,render_element,1, [{file,"src/elements/layout/element_dtl.erl"},{line,12}]},

This is corrected by including app=real-app-name when returning from main/0 but hardcoding an app name all over the place isn't optimal. I'm not sure what the best resolution for the underlying issue might be but a note somewhere that this is the case might be helpful for the next guy.

Thanks!

bullet.js errors on newly created n2o node

I'm just setted up n2o as described in http://synrc.com/framework/web/setup.htm and when try to login from page http://carbona.su:8000/ I've got next errors:

Chrome console shows:
Object function (e,n){return new x.fn.init(e,n,t)} has no method 'ajax'

and Firefox console shows:
Firefox can not setup connection with server ws://carbona.su:8000/ws/. @ http://carbona.su:8000/static/nitrogen/bullet.js:125
TypeError: $.ajax is not a function @ http://carbona.su:8000/static/nitrogen/bullet.js:101

The 'text' field is missing in element?

I found many element does not support 'text' property yet, such as label, span or button.

The compiling shell said : field text undefined in record button.
Is it a bug?

Remote Code Execution

N2O in default configuration allows remote code execution. I was able to do this with the sample application. I'm not sure if production apps do any kind of filtering to prevent this. You can contact me privately for PoC code. [email protected]

n2o_session:clear() undefined

Hello,

wf:logout() ends up calling n2o_session:clear(), which is undefined. Can I hope for this to be implemented in near future?

Thanks and kind regards.

Как отловить реконнект + пространные размышления из irc

От меня что-то типо issue (можно не читать:) )

  1. event(init) дергается только при получении <<"N2O,",Rest/binary>> = InitMarker, который не вызывается при дисконнекте-реконнекте.
    Хотелось бы какой-нибудь ивент, который дергается при любом подключении, будь то коннект или реконнект, иначе, чтобы прилепить какое-нибудь действие на любое поднятие приходится в модуль сессии это пихать. Возможно не каждому это нужно, но вдруг понадобится - приходится слишком далеко это класть.
  2. для спонтанного посыла клиенту сообщения я сделал
    ws_send(Msg) -> self() ! {bert, {reply, Msg}}.
    event({reply, Msg}) -> Msg; %% просто вернуть Msg и он отправится клиенту.
    либо я делаю что-то не так, либо так делает много кто и можно было бы добавить это в n2o

а тут я просто записал на мой взгляд ключевые вещи, что прозвучали в irc
Речь идет про модуль обработки контроллеров
хочется (кому-то):

  1. чтобы был доступен контекст, в котором будут доступны параметры из контекста, а так же некая свободная часть для контекста страницы. что-то типо -record(cx, {handlers, actions, req, module, path, session, params, pg}).
    где pg - часть предоставленная для свободного хранилища чего-нибудь.
  2. чтобы не было неразберихи с протоколами {client, server, bert, binary}
  3. чтобы было понятно, откуда, куда и зачем идет сообщение. Чтобы можно было точно отличить сообщение, которое пришло от клиента и сообщение, которое пришло через WsPid ! Msg.
  4. Чтобы модуль контроллеров не был особо ограничен (чтобы были доступны хотя бы для чтения всякие штуки из контекста)
  5. Избавиться от неразберихи с тем, что эти ивенты возвращают, будет ли это отправляться на клиент или не будет. "<5HT> и каждый ивент возвращал бы {reply,...}, {noreply,...}, OTP шные ответы"

Тезис: окультурить все нужно, похуй на совместимости
Тезис: СОБЫТИЕ = УПАКОВАННОЕ СООБЩЕНИЕ ПРОТОКОЛА + КОНТЕКСТ ПРОЦЕССА

Вроде все вписывается в handle(#ev{},#cx{})

Подскажите, как обработать ситуацию.

Алгоритм такой:

  1. Запускаем приложение.
  2. Заполняем форму. Получаем адекватный ответ.
  3. Перезапускаем приложение.
  4. Нажимаем еще раз нужную кнопку и ...

http://pastebin.com/H90m1SCp

С точки зрения фреймворка все логично. Пользователь не был залогинен, но что-то шлет.

Хочется ему сделать wf:redirect("/login") , но не знаю где. Патчить n2o только для себя не хочется, что бы потом каждый раз патчи не накладывать. А придумать генеральную политику партии надо авторам идеи и фреймворка.

ENOLICENSE

You definitely should add LICENSE file with proper license

проблема с wf:update

привет
тоже была запарка с wf:update\wf:js_escape как в #53 но проблема в том что я передавал в wf:update #dtl, т.е. js_escape нужно делать после wf:render - имхо нужно в action_jq это вставить

оригинал

[wf:to_list(T),wf:to_list(P),binary_to_list(iolist_to_binary(wf:render(R)))]);
....
[wf:to_list(T),wf:to_list(P),binary_to_list(iolist_to_binary(wf:render(R)))]).

правки

[wf:to_list(T),wf:to_list(P),binary_to_list(iolist_to_binary(wf:js_escape(wf:render(R))))]);
....
[wf:to_list(T),wf:to_list(P),binary_to_list(iolist_to_binary(wf:js_escape(wf:render(R))))]).

FreeBSD make

Это, конечно, проблема make freebsd-way, однако unknown modifier ',' говорит оно при запуске консоли примера.

sample app wont compile

./rebar compile
Compiled src/wf_utils.erl
Compiled src/wf_context.erl
Compiled src/wf_render_elements.erl
Compiled src/static_file.erl
==> n2o_sample (compile)
Compiled src/users.erl
Compiled src/login.erl
Compiled src/routes.erl
Compiled src/web_app.erl
Compiled src/index.erl
Compiled src/web_sup.erl
ERROR: 
===============================================
 You need to install erlydtl to compile DTL templates
 Download the latest tarball release from github
    http://code.google.com/p/erlydtl/
 and install it into your erlang library dir
===============================================

ERROR: compile failed while processing /home/evgeny/projects/erlang/n2o/samples/deps/n2o_sample: rebar_abort

Apostrophes are not escaped during element rendering

Hello again,

I ran into a bug - see the title. Example:
wf:update(test_id, <<"This string contains ' an apostrophe">>);
renders into:
$('#test_id').html('This string contains ' an apostrophe');
which of course creates a syntax error.
I can imagine there are some more chars that might cause similar problems.

Kind regards.

wf:redirect does not work.

Hi, it's me again. :-)

I saw in examples ( skyline ) next code:

main() ->
case wf:user() of undefined -> wf:redirect("/login"); _ -> [#dtl{file = wf:cache(mode), ext="dtl",bindings=[{title,<<"Account">>},{body,body()}]}] end.

In case of undefined It's not working. Why ? Cowboy returns empty page with next headers:

HTTP/1.1 200 OK
connection: keep-alive
server: Cowboy
date: Tue, 06 May 2014 19:07:55 GMT
content-length: 0
set-cookie: n2o-sid=1AKKkVnwL+qF4A4gSKYapA==; Version=1; Expires=Wed, 07-May-2014 19:07:55 GMT; Max-Age=86400; Path=/

But redirect works well when it called from event(X). WTF ?
Version HEAD.

small typo

line 20 in n20_cowboy.erl

headers(Req) -> cowboy_reg:headers(Req).

reg should be req

How to let N2O support Chinese Code?

follow page have three problem:

  1. title() and h1() can't use Chinese code
  2. wf:info/3 can't print Chinese code
  3. the communication stopped if I use Chinese code in #confirm

%% page source
%% ----------------
-module(hello).
-compile(export_all).
-include_lib("n2o/include/wf.hrl").

title() -> [ <<"Hello">> ].
main() -> #dtl{file = "index", app=n2o_sample,bindings=[{title,title()},{body,body()}]}.

body() ->
wf:info(?MODULE,"RENDER!", []),
[
#h1 {body= <<"你好">>},
#button { id=mybutton, body="my button", postback=confirm}
].

event(confirm) ->
wf:info(?MODULE, "confirm message...", []),
wf:wire(#confirm{text= "确定吗?", postback=continue}),
wf:info(?MODULE, "我还没挂", []);
event(continue) -> wf:info(?MODULE, "你是对的!", []).

element_upload.erl

Hi,

I'm not sure of the correct way to create elements, but have written a first attempt at a upload file element.
element_upload.erl

-module (element_upload).
-include_lib("n2o/include/wf.hrl").
-export([ reflect/0, render_element/1] ).

-spec reflect() -> [atom()].
reflect() -> record_info(fields, upload).

render_element(Record) ->
Id = Record#upload.id,
Hidden_id = list_to_atom(Id ++ "_data"),
Fun = wf:f("function (evt) {"
"var input = evt.target;"
"if(input.files && input.files[0]) {"
"var reader = new FileReader();"
"reader.onload = function(e) {"
"var data = e.target.result;"
"var hidden = document.getElementById('~s');"
"hidden.value = data; "
"};"
"reader.readAsDataURL(input.files[0]); } }",[Hidden_id]),
wf:wire(wf:f("document.querySelector('#~s').addEventListener('change',~s);"
,[Id,Fun])),
[
wf_tags:emit_tag(<<"input">>, [
{id,Id},
{value, Record#upload.value},
{type, file},
{style, Record#upload.style}
]),
wf_tags:emit_tag(<<"input">>, [
{type, hidden},
{id, Hidden_id}
])
].

and wf.hrl
-record(upload, {?ELEMENT_BASE(element_upload), name}).

Странный баг в wf:update()?

Джентельмены,

У меня есть странный баг в javascript. Воспроизводится у меня следующим образом.

try
error_logger:info_msg("[~s] SMS view camp #pn", [U#smsuser.email, CampId]),
CampTable = get_camp_table(store_pgsql:pgsql_client(), CampId),
Sms = store_pgsql:read_camp_messages(CampId, CampTable),
Table = smsviewer:table_view(Sms),
Modal = modal(Table),
wf:update(modal_camps, Modal),
wf:wire("$('#modal_camps').modal('show');")
catch
throw:{error, Reason} -> wf:error("pn",[Reason]), wf:wire(wf:f("alert('~s');",[Reason]))
% _:Reason -> wf:error("pn",[Reason]), wf:wire(wf:f("alert('Ошибка при выполнении запроса.');"))
end

Пояснения к коду.
CampTable = название временной таблицы в БД. Sms - массив СМС с типом #sms.
Table = сгенерированная записями n2o таблица. Modal - сгенерированное n2o-записями модальное окно для Twitter Bootstrap.

В результате wf:update() происходит Syntax error в Google Chrome с диагностикой ILLEGAL TOKEN и div #modal_camps остается не изменненным.

ВНИМАНИЕ! Только если в тексте СМС встречается какая-то херня. Какая именно, я еще не определил. И именно в тексте, а не в других полях. Если #td{body = Sm#sms.readable } закомментировать, то все работает ОК. Readable = text в БД = binary() в erlang. В большинстве случаев этого эффекта нет. Но в последнем случае текст равен ->

pearlsms=> select id,readable from camp_messages_161_20140107_1722 order by id limit 3;
id | readable
--------+---------------------------------------------------------------------
193850 | Вы можете автоматически подставлять в сообщения данные из списков.
193851 | Например, Имя. Вместо необходимого параметра используйте следующие
193852 | модификаторы: +
|
(3 rows)

Подозреваю дело в переводе строки в сообщении 193852, но это я проверю в течение дня.
Но не могли бы Вы и со своей стороны проверить работу wf:update()? Спасибо.

wf:info/1 and wf:info/2 can't work correctly

What's happend?

Only info/3 worked well in follow functions:

info(Module,String, Args) -> log(Module,String, Args, info_msg).
info(String, Args) -> log(?MODULE, String, Args, info_msg).
info(String) -> log(?MODULE, String, [], info_msg).

Perhaps warning/1,2,3 and error/1,2,3 have the same problems.

Rebar compile errors.

Hi, N2O team!

I have some trouble when rebar compile, I get follow errors:

n2o/samples/apps/web/src/index.erl:23: field body undefined in record button
n2o/samples/apps/web/src/index.erl:25: field body undefined in record button
n2o/samples/apps/web/src/index.erl:26: field body undefined in record button
n2o/samples/apps/web/src/index.erl:29: field body undefined in record button

I get n2o from here, github repo.

Many thanks for help! Best regards. Dmitriy.

application: fs startup fail

I have compiled the version 1.5 n2o, make success.

when "make console" to run, I find the following error message, reported it for you.

n2o/samples/>make console
./orderapps.erl n2o_sample n2o fs erlydtl cowboy sh mad gproc rest cowlib ranch active > .applist
ERL_LIBS=apps:deps erl -args_file rels/web/files/vm.args -config rels/web/files/sys.config -eval '[application:start(A) || A <- [kernel,stdlib,xmerl,compiler,syntax_tools,erlydtl,crypto,cowlib,ranch,cowboy,gproc,n2o,n2o_sample,fs,sh,mad,rest,active,asn1,edoc,eunit,gs,hipe,inets,mnesia,parsetools,public_key,runtime_tools,ssl,tools,webtool]]'
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [async-threads:5] [hipe] [kernel-poll:true]

Eshell V5.10.4 (abort with ^G)
([email protected])1>
=INFO REPORT==== 5-Jun-2014::15:28:50 ===
application: fs
exited: {{bad_return_value,executable_not_found},
{fs_app,start,[normal,[]]}}
type: temporary

([email protected])1>

How to get checkbox state ?

Hi, again.

I have element like this:

      #checkbox{id=islatin, name=islatin, class=["checkbox"], 
       checked=false, value=off, body= <<" ">>},

After button click: #button{class=["btn btn-primary"], id=btn_send_one, body= <<"Send">>,delegate=sendsms, postback=send_one, source=[sender, msisdn, msgtext, issubst, islatin, isdelayed ]} I got event

      event(send_one) -> 
        error_logger:info_msg("Submit send one message: ~p, ~p, ~p, ~p, ~p, ~p, ~p", [ 
          wf:q(sender), 
          wf:q(msisdn), 
          wf:q(msgtext),
          wf:q(issubst),
          wf:q(islatin),
          wf:q(isdelayed)
        ]);

When 'islatin' checkbox was checked as result I got :

[info] Submit send one message: "privatbankas", "380504139380", "privet", "off", "off", "off", []

Why ? How I can get state "checked or not" from checkbox called 'islatin'.
Should I declare postback and delegate names and get event when state changed ?

make sample error

there Is two errors when running make in samples directory on CentOS6.5 with linux kernel 2.6.32.

  1. sys/fanotify.h: No such file or directory.
  2. fanotify_watch.c:58: error: expected ‘)’ before ‘mask’

i upgrade the kernel to 2.6.39.4, the first error is disappear, but the second is still there.

what should i do?

thank you!

ERROR: Compiling src/endpoints/cowboy/bullet_handler.erl failed

Cannot compile n2o using rebar get-deps compile:

arch:n2o:<master>% rebar get-deps compile ==> ranch (get-deps) ==> cowboy (get-deps) ==> mimetypes (get-deps) ==> gproc (get-deps) ==> erlydtl (get-deps) ==> n2o (get-deps) ==> ranch (compile) ==> cowboy (compile) ==> mimetypes (compile) ==> gproc (compile) ==> erlydtl (compile) ==> n2o (compile) Compiling src/endpoints/cowboy/bullet_handler.erl failed: src/endpoints/cowboy/bullet_handler.erl:1: cannot parse file, giving up src/endpoints/cowboy/bullet_handler.erl:1: no module definition src/endpoints/cowboy/bullet_handler.erl:1: cannot translate from UTF-8 ERROR: compile failed while processing /home/wal/work/erlang/n2o: rebar_abort

Returns of 'select' element. Just a question.

Hi, again. :)

It's just interesting for me. Why do you return string like "item1,item2,item3" from multiple select element ? It would be easy to handle if select will return array of items like ["38","41"] or ["item1","item2"]. In single case will fine to return single element in array like ["42"] or [42] or ["selected item"].

Thank you.

Sample app won't release

$ ./release.sh
Releasing node web...
==> web (generate)
ERROR: generate failed while processing /Users/********/Dropbox/Code/Erlang/n2o/samples/rels/web: {'EXIT',{{badmatch,{error,"Release "node" uses non existing application sync"}},
[{rebar_reltool,generate,2,[]},
{rebar_core,run_modules,4,[]},
{rebar_core,execute,4,[]},
{rebar_core,process_dir0,6,[]},
{rebar_core,process_commands,2,[]},
{rebar,main,1,[]},
{escript,run,2,[{file,"escript.erl"},{line,747}]},
{escript,start,1,[{file,"escript.erl"},{line,277}]}]}}
./release_sync.sh: line 14: rebar.config: syntax error: invalid arithmetic operator (error token is ".config")
./release_sync.sh: line 25: rels/web/node/lib/n2o_sample-
: division by 0 (error token is "/node/lib/n2o_sample-*")

Running Bash 4.2 on OSX.

FYI erlang.mk compatibility

erlang.mk is compatible with projects that use rebar, so long as there is a Makefile.
Also, in the .src file there needs to be a {modules,[]} declared.

With a recent rebar, REBAR_DEPS_DIR is respected and a dependency's deps are placed in the parent's root deps directory.

erlang.mk compatibility

/Peter

ERROR: Compiling template priv/templates/hello.html failed

Can't install N2O.
Ubuntu 12.04, Erlang R16B02, rebar 2.0.0 R15B01
Shell output:
...
==> Leaving directory `/home/asakura/n2o/samples/deps/n2o'
==> n2o_sample (compile)
Compiled src/users.erl
Compiled src/login.erl
Compiled src/web_sup.erl
Compiled src/web_app.erl
src/routes.erl:3: Warning: behaviour route_handler undefined
Compiled src/routes.erl
Compiled src/index.erl
:0: Warning: function render_tag/3 is unused
:0: Warning: function render_tag/3 is unused
:0: Warning: function render_tag/3 is unused
ERROR: Compiling template priv/templates/hello.html failed:
{ok,hello_view,[{[],[{0,erl_lint,{unused_function,{render_tag,3}}}]}]}

exception error: no match of right hand side value {["get-deps"],[]}

Hi, N2O team!

I have some trouble when make, I get follow errors:

./mad get-deps
Bundle: "./mad"
escript: exception error: no match of right hand side value {["get-deps"],[]}
in function mad_utils:fold_params/1 (src/mad_utils.erl, line 81)
in call from mad:main/1 (c:/Synrc/n2o/samples/deps/mad/src/mad.erl, line 10)
in call from escript:run/2 (escript.erl, line 747)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_it/1
in call from init:start_em/1
make: *** [get-deps] Error 127

5HT/n2o ver 1.8 compile error

I compile the new 5HT/n2o ver 1.8, but I got the following error message:

/home/whw/bak/n2o/n2o-1.8.0/samples/>make
fatal: Not a git repository (or any of the parent directories): .git
./mad get-deps
==> dependency: "git://github.com/evanmiller/erlydtl" tag: {tag,"0.8.0"}
==> dependency: "git://github.com/extend/cowboy" tag: {tag,"1.0.0"}
==> dependency: "git://github.com/extend/cowlib.git" tag: "1.0.0"
==> dependency: "git://github.com/extend/ranch.git" tag: "1.0.0"
==> dependency: "git://github.com/uwiger/gproc.git" tag: {tag,"0.3"}
Error evaluating script remove_deps.script
Error evaluating script check_edown.script
==> dependency: "https://github.com/esl/edown.git" tag: "HEAD"
==> dependency: "https://github.com/garret-smith/gen_leader_revival.git" tag: "HEAD"
==> dependency: "git://github.com/synrc/fs" tag: {tag,"0.8"}
==> dependency: "git://github.com/synrc/sh" tag: {tag,"0.8"}
==> dependency: "git://github.com/synrc/active" tag: {tag,"0.8"}
==> dependency: "git://github.com/synrc/mad" tag: {tag,"0.8"}
==> dependency: "git://github.com/synrc/rest" tag: {tag,"1.5.0"}
==> dependency: "git://github.com/synrc/kvs" tag: {tag,"1.5.0"}
==> dependency: "git://github.com/5HT/n2o" tag: {tag,"1.8.0"}
rm -rf apps/n2o_sample/priv/static/nitrogen
ln -s ../../../../deps/n2o/priv apps/n2o_sample/priv/static/nitrogen
./mad compile
==> "erlydtl"
==> "cowboy"
==> "cowlib"
Unknown file type: "/home/whw/bak/n2o/n2o-1.8.0/samples/deps/cowlib/src/cow_mimetypes.erl.src"
==> "ranch"
==> "gproc"
Error evaluating script remove_deps.script
Error evaluating script check_edown.script
==> "edown"
==> "gen_leader"
==> "fs"
==> "sh"
Port Compilation Error: <<99,99,58,32,67,111,114,101,70,111,117,110,100,97,116,
105,111,110,239,188,154,230,178,161,230,156,137,233,
130,163,228,184,170,230,150,135,228,187,182,230,136,
150,231,155,174,229,189,149,10,99,99,58,32,67,111,
114,101,83,101,114,118,105,99,101,115,239,188,154,
230,178,161,230,156,137,233,130,163,228,184,170,230,
150,135,228,187,182,230,136,150,231,155,174,229,189,
149,10,99,99,49,58,32,233,148,153,232,175,175,239,
188,154,230,151,160,230,179,149,232,175,134,229,136,
171,231,154,132,229,145,189,228,187,164,232,161,140,
233,128,137,233,161,185,226,128,156,45,102,114,97,
109,101,119,111,114,107,226,128,157,10,99,99,49,58,
32,233,148,153,232,175,175,239,188,154,230,151,160,
230,179,149,232,175,134,229,136,171,231,154,132,229,
145,189,228,187,164,232,161,140,233,128,137,233,161,
185,226,128,156,45,102,114,97,109,101,119,111,114,
107,226,128,157,10,99,99,49,58,32,233,148,153,232,
175,175,239,188,154,230,151,160,230,179,149,232,175,
134,229,136,171,231,154,132,229,145,189,228,187,164,
232,161,140,233,128,137,233,161,185,226,128,156,45,
102,114,97,109,101,119,111,114,107,226,128,157,10,99,
99,49,58,32,233,148,153,232,175,175,239,188,154,230,
151,160,230,179,149,232,175,134,229,136,171,231,154,
132,229,145,189,228,187,164,232,161,140,233,128,137,
233,161,185,226,128,156,45,102,114,97,109,101,119,
111,114,107,226,128,157,10,99,99,49,58,32,233,148,
153,232,175,175,239,188,154,230,151,160,230,179,149,
232,175,134,229,136,171,231,154,132,229,145,189,228,
187,164,232,161,140,233,128,137,233,161,185,226,128,
156,45,102,114,97,109,101,119,111,114,107,226,128,
157,10,99,99,49,58,32,233,148,153,232,175,175,239,
188,154,230,151,160,230,179,149,232,175,134,229,136,
171,231,154,132,229,145,189,228,187,164,232,161,140,
233,128,137,233,161,185,226,128,156,45,102,114,97,
109,101,119,111,114,107,226,128,157,10>>==> "sh"
Port Compilation Error: <<99,99,58,32,67,111,114,101,70,111,117,110,100,97,116,
105,111,110,239,188,154,230,178,161,230,156,137,233,
130,163,228,184,170,230,150,135,228,187,182,230,136,
150,231,155,174,229,189,149,10,99,99,58,32,67,111,
114,101,83,101,114,118,105,99,101,115,239,188,154,
230,178,161,230,156,137,233,130,163,228,184,170,230,
150,135,228,187,182,230,136,150,231,155,174,229,189,
149,10,99,99,49,58,32,233,148,153,232,175,175,239,
188,154,230,151,160,230,179,149,232,175,134,229,136,
171,231,154,132,229,145,189,228,187,164,232,161,140,
233,128,137,233,161,185,226,128,156,45,102,114,97,
109,101,119,111,114,107,226,128,157,10,99,99,49,58,
32,233,148,153,232,175,175,239,188,154,230,151,160,
230,179,149,232,175,134,229,136,171,231,154,132,229,
145,189,228,187,164,232,161,140,233,128,137,233,161,
185,226,128,156,45,102,114,97,109,101,119,111,114,
107,226,128,157,10>>==> "active"
==> "mad"
==> "rest"
==> "kvs"
==> "n2o"
==> "/home/whw/bak/n2o/n2o-1.8.0/samples/apps"
==> "/home/whw/bak/n2o/n2o-1.8.0/samples/apps/n2o_sample"
==> erlydtl
/home/whw/bak/n2o/n2o-1.8.0/samples/>

Configurable bridge

It would be great to be able to change the default bridge (n2o_cowboy). It is possible now by using the BRIDGE define, but you can't easily do it when using n2o as dependency. The only way I found so far is adding erl_opts to n2o's rebar config, but I'd like to avoid changing dependencies' code.

Could it be configurable via application env, like for instance session handler?

upload сломан. call to undefined function UNDEFINED:control_event.

Все-таки либо у Вас что-то незадокументировано, либо ошибка. Я подчеркнул где.

13:53:03.290 [error] Cowboy handler bullet_handler terminated in bullet_handler:websocket_handle/3 with reason:

call to undefined function undefined:control_event("filename", {query_file,"/Users/rad/git/erlang/Pearl-SMS-

Stream/rels/web/node/lib/web-1/priv/static",[],<<"1.c...">>,…})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.