With normal client-to-server connections, each client must use a separate connection. Clients normally don't send their JID in the from
attribute of the opening tag of the XML stream, but identify themselves during SASL authentication.
ejabberd supports the protocol described in XEP-0114, whereby your system can connect to the ejabberd as a "component", and send and receive messages on behalf of many different users. Depending on what you want to do, you may have to reimplement a lot of what ejabberd would do for you out of the box, e.g. presence subscriptions, roster management, routing of messages between users in your system. The only things ejabberd does for you in this case is sending you all messages to recipients in a certain domain, and route any outbound messages you send.