title: Elixir - Check if string is empty
body: <p>I am playing with <code>Elixir</code> and <code>Phoenix Framework</code> for the first time after following this <a href="https://hexdocs.pm/phoenix/channels.html" rel="nofollow noreferrer">Tutorial</a>..</p>
  
  <p>I have a simple client/server app.</p>
  
  <p>chat/lib/chat_web/room_channel.ex:</p>
  
  <pre><code>defmodule ChatWeb.RoomChannel do
    use Phoenix.Channel
  
    def join("room:lobby", _message, socket) do
      {:ok, socket}
    end
    def join("room:" &lt;&gt; _private_room_id, _params, _socket) do
      {:error, %{reason: "unauthorized"}}
    end
  
    def handle_in("new_msg", %{"body" =&gt; body}, socket) do
      broadcast! socket, "new_msg", %{body: body}
      {:noreply, socket}
    end
  end
  </code></pre>
  
  <p>I want to block empty incoming messages (<code>body</code> is empty string)</p>
  
  <pre><code>def handle_in("new_msg", %{"body" =&gt; body}, socket) do
    # I guess the code should be here..
    broadcast! socket, "new_msg", %{body: body}
    {:noreply, socket}
  end
  </code></pre>
  
  <p>How can I do that?</p>