mochiweb

Exception error: undefined function in Mochiweb/Erlang

After seeing this article, I have been tinkering with mochiweb. While trying to replicate what's done in the article - basically setting up a mochiweb server, having two erlang nodes, and then calling a function defined in one node in the other (after setting net_adm:ping() between the two nodes so they know each other). I was able to f...

When to use gen_server in Erlang/OTP applications

Having read Joe Armstrong's book and watched Kevin Smith screencasts I've built a simple OTP application comprised of a single gen_server and single supervisor, bundled together as an OTP application. Now I'm looking at mochiweb and have created a sample project [helloworld] using the new_mochiweb.erl script. Browsing the source code I ...

what this error means? [Erlang, mochiweb, MySQL]

Hi there, I made a comet chat server with Erlang and Mochiweb. And I run the "./start-dev.sh" to start the server. But after about 1 month I got the following error: =ERROR REPORT==== 26-Sep-2009::09:21:06 === {mochiweb_socket_server,235, {child_error, {badmatch, {error, [70,97,105,108,101,100,32...

Mochiweb Port 80

Hello - I am attempting to run BeepBeep through Mochiweb on Port 80. It works if I type sudo ./start_server.sh. Are there any security risks with running Mochiweb like this? If so how to remedy? Thanks! ...

mochijson2 or mochijson

Hi guys. I'm encoding some data using mochijson2. But I found that it behaves strange on strings as lists. Example: mochijson2:encode("foo"). [91,"102",44,"111",44,"111",93] Where "102", "111", "111" are $f, $o, $o encoded as strings 44 are commas and 91 and 93 are square brakets. Of course if I output this somewhere I'll ...

Mochiweb mnesia requests

I'm trying to link Mochiweb with my ejabberd mnesia db and am unable to do any mnesia transactions in my controllers. I test my controllers without the mnesia transactions and they work fine. I am using application:start(mnesia) inside the start function. On the browser, I see "Internal server error" and on Mochiweb's log I see, "=ERR...

How to enable active sockets in a Mochiweb application?

Does anyone know how to enable active instead of passive sockets in a Mochiweb application. Specifically, I am trying to adapt http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-2 so that when a client disconnects, it will immediately "logout". I have tried setting: start(Options) -> {DocRoot, Optio...

init.d script for a mochiweb app

Hi, Anyone has an init.d script for a mochiweb application on ubuntu to share? Thanks ...

Mochiweb Log files

Anyone know where Mochiweb logs files by default? I'm running it along with the Beepbeep framework. ...

Mochiweb debug (like ejabberd debug)

I was wonderng if anyone knows of a way to get into Mochiweb like ejabberd does when you run /sbin/ejabberdctl debug? ...

Erlang Front-End Admin Panel

We're looking for a framework in which we can assign multiple roles to different users and allow those users to in turn manipulate certain data (based on their role). We have an ejabberd backend and a Mochiweb (BeepBeep framework) front end, and the nodes are connected so Mochiweb can manipulate ejabberd's mnesia tables. Does a direc...

Mochiweb : Reading a file as it is uploaded

I want to be able to read a file just as it is being uploaded by the user, i.e. I want to read the incoming stream of bytes from the user's browser.. Is that possible with Mochiweb? If not, where do I need to look/modify? If something else easier exists on Yaws, that will also be great. Thanks. ...

[AS2] sendAndLoad, cross domain & mochi ads preloader

In my flash game I use sendAndLoad to send information about the game played back to my server for for a high scoreboard. I have recently started using MochiAds meaning that it my swf is hosted on another domain to where the PHP script resides. If I use version control with the automatic preloader the sendAndLoad function just never se...

Where does Nitrogen get the best performance - yaws, mochiweb, or inets?

The Nitrogen project web page declares equal support for yaws, mochiweb, and inets, but with which of these web servers is it going to perform the best? I.e. for a large scale application with mostly dynamic content with nitrogen + a web server which combination will be able to handle the most user load? ...

Detecting HTTP close using inet

In my mochiweb application, I am using a long held HTTP request. I wanted to detect when the connection with the user died, and I figured out how to do that by doing: Socket = Req:get(socket), inet:setopts(Socket, [{active, once}]), receive {tcp_closed, Socket} -> % handle clean up Data -> % do someth...

Starting two mochiweb servers with a single script file

I have a basic web server that I generated from the mochiweb framework. To start it I use the start.sh script that the framework automatically generates. Everything works fine and the server starts up. Now I have one more mochiweb server that I want to start along with the first one. Again, this starts up perfectly standalone with its st...

Decode JSON with mochijson2 in Erlang

I have a var that has some JSON data: A = <<"{\"job\": {\"id\": \"1\"}}">>. Using mochijson2, I decode the data: Struct = mochijson2:decode(A). And now I have this: {struct,[{<<"job">>,{struct,[{<<"id">>,<<"1">>}]}}]} I am trying to read (for example), "job" or "id". I tried using struct.get_value but it doesn't seem to work...

Mochiweb's Scalability Features

From all the articles I've read so far about Mochiweb, I've heard this over and over again that Mochiweb provides very good scalability. My question is, how exactly does Mochiweb get its scalability property? Is it from Erlang's inherent scalability properties or does Mochiweb have any additional code that explicitly enables it to scale ...

Erlang Facebook Example

Does anyone know of an example facebook app (or facebook connect app) done in Erlang? I'm looking for something that includes the whole process. Specifically I don't seem to find anything on user authentication. I've checked out erlang_facebook, erlang2facebook and erlyface but none of them seem to offer a simple and comprehensive examp...

Long Polling in Mochiweb - How to tell if client aborts request?

I have a basic mochiweb polling loop that looks like the following, except it does other things instead of printing to the console and eventually returns: blah() -> io:format("Blah") blah() loop(Req) -> PathParts = string:tokens(Req:get(path), "/") case PathParts of ["poll"] -> blah() This works great until the cl...