I have a cowboy ws handler with binary pattern matching as follows:
websocket_handle({text, <<"Reg: ",Message/binary>>}, Req, State)
I need to call this handler with js code, so I use Bert.js to encode js string variable to binary erlang term as follows:
websocket.send(Bert.encode(Bert.binary("<<\"Reg: \" , \""+input2 + "\">>")));
But I couldn't invoke my handler with this encoded argument !!
Is my encoded argument wrong ? or is there another method to make an erlang binary term with js ?