[erlang-questions] NineNines Bullet

Lee Sylvester <>
Tue Apr 2 23:11:27 CEST 2013


Perfect :-)  Thanks Loïc.

Lee


On 2 Apr 2013, at 22:10, Loïc Hoguin <> wrote:

> Pid ! {you_got_mail, TheMessage} and receive it in info:
> 
> info({you_got_mail, TheMessage}, ...) ->
>   {reply, TheMessage, ...};
> 
> On 04/02/2013 11:09 PM, Lee Sylvester wrote:
>> Another thing; I'm guessing returning {reply,…} from the stream function sends a reply to the user for that connection and returning {ok,…} doesn't.  How, though, do I send a message to some other specific user, providing I have their Pid?
>> 
>> Thanks,
>> Lee
>> 
>> 
>> 
>> 
>> On 2 Apr 2013, at 22:00, Lee Sylvester <> wrote:
>> 
>>> Yes, that's how I was seeing it.  Mentally at least.  I've got a similar thing built in Go which I want to port to Erlang using Bullet.  Go's websocket implementation is quite far from complete and has been a headache to work with.  I'm hoping to have something a lot more robust with Erlang.
>>> 
>>> So, let me get this straight… init handles the connection setup and terminate handles the teardown. So, I can make calls in those two functions to add the user to a room collection or removing her.
>>> 
>>> What are the differences between stream and info?  When do those come into play?  I'm assuming one (stream?) is invoked when data is sent from the end user. Is that right?
>>> 
>>> Thanks,
>>> Lee
>>> 
>>> 
>>> 
>>> On 2 Apr 2013, at 21:35, Loïc Hoguin <> wrote:
>>> 
>>>> Rooms is a bit out of scope. I agree it could use some more documentation though.
>>>> 
>>>> The basic idea is that when your process connects its pid is added to a list somewhere (gproc, gen_server, anything else). When a message is sent to the room, all pids in the list receive it. You can also broadcast when someone enters or leave the room. And you remove the pid from the list when it's gone (using monitors for example).
>>>> 
>>>> On 04/02/2013 10:27 PM, Lee Sylvester wrote:
>>>>> Hi Loïc,
>>>>> 
>>>>> Yes, I spotted that.  It just doesn't seem very explanatory.  I was hoping for something a little bit more extensive.  Preferably something that used the concept of rooms.  The NineNines support page for Bullet is also a little thin… :-S  I guess I'm too much of a noob.
>>>>> 
>>>>> Thanks,
>>>>> Lee
>>>>> 
>>>>> 
>>>>> 
>>>>> On 2 Apr 2013, at 21:23, Loïc Hoguin <> wrote:
>>>>> 
>>>>>> On 04/02/2013 10:08 PM, Lee Sylvester wrote:
>>>>>>> Hey guys,
>>>>>>> 
>>>>>>> Does anyone here know of a good tutorial or chat example of NineNines Bullet handler for Cowboy?
>>>>>> 
>>>>>> Have you looked at the clock example that comes with it? Building a chat on top of that is just making connection processes talk to each other using a registry like gproc or a gen_server that dispatches messages.
>>>>>> 
>>>>>> --
>>>>>> Loïc Hoguin
>>>>>> Erlang Cowboy
>>>>>> Nine Nines
>>>>>> http://ninenines.eu
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> Loïc Hoguin
>>>> Erlang Cowboy
>>>> Nine Nines
>>>> http://ninenines.eu
>>> 
>> 
> 
> 
> -- 
> Loïc Hoguin
> Erlang Cowboy
> Nine Nines
> http://ninenines.eu




More information about the erlang-questions mailing list