[erlang-questions] how to reply message using erlang timer module

Igor Clark <>
Sat Sep 23 12:17:23 CEST 2017


Hi Palanikumar,

It looks like you're passing the erlang:start_timer/3 
<http://erlang.org/doc/man/erlang.html#start_timer-3> arguments to 
timer:apply_interval/4 
<http://erlang.org/doc/man/timer.html#apply_interval-4>:

erlang:start_timer(Time, Dest, Msg)

vs

apply_interval(Time, Module, Function, Arguments)

erlang:start_timer/3 sends Msg to Dest after Time ms; 
timer:apply_interval/4 calls Module:Function(Arguments) every Time ms.

So the error message is telling you that the function 
timer:apply_interval/3 you're trying to call doesn't exist.

HTH,
Igor

On 23/09/2017 10:50, Palanikumar Gopalakrishnan wrote:
> Hi Guys,
>
>              I want  to send  message to the front-end via websocket 
> in particular time interval.
> So i use timer module for this purpose.
> *timer:apply_interval(1000, self(), <<"How' you doin'?">>),*
> *
> *
> *
> *
> But it returns the following error
>
> *15:18:20.558 [error] CRASH REPORT Process <0.570.0> with 0 neighbours 
> crashed with reason: call to undefined function 
> timer:apply_interval(6000, <0.570.0>, <<"How' you doin'?">>)
> 15:18:20.558 [error] Ranch listener my_cowboy_ws_server terminated 
> with reason: call to undefined function timer:apply_interval(6000, 
> <0.570.0>, <<"How' you doin'?">>)
>
>
> *
> Its there any way to solve this problem.
>
> I already tried with
>
> *erlang:start_timer(60000, self(), <<"How' you doin'?">>)
>
> *
> Its only send message after particular timer. I didn't found method in 
> this module to send message in particular interval.
>
>
>
>
>
>
>
>
>
>
> -- 
>
> *Warm Regards,*
>
> *Palanikumar Gopalakrishnan *✌
> *Developer*
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170923/01ed667e/attachment.html>


More information about the erlang-questions mailing list