thangiee / lol-chat-lib

Pure functional library for interacting with League of Legends chat servers.


LoL Chat Lib

Codacy Badge Dependency Status

Pure functional library for interacting with League of Legends chat servers.


  • Import with SBT

    Projects that target a JVM supporting Java7+:

    resolvers += "jcenter" at ""
    libraryDependencies ++= Seq(
      "org.igniterealtime.smack" % "smack-java7" % "4.1.7",
      "com.github.thangiee" %% "lol-chat-lib" % "0.3.0"

    Projects that target android:

    resolvers += "jcenter" at ""
    libraryDependencies ++= Seq(
      "org.igniterealtime.smack" % "smack-android" % "4.1.7",
      "com.github.thangiee" %% "lol-chat-lib" % "0.3.0"

    For other build tools look here:


Import library

import lolchat._
import lolchat.model._

Create a session and login.

val sess = Session("username", "passwd", Region.NA)

You can combine multiple operations with for-comprehension.

val getFriends =
  for {
    _ <- login
    f <- friends
  } yield f

val result: ChatResult[Vector[Friend]] =

Notice resulting type. will return ChatResult[...] which is an asynchronous computation that can either be a ChatError type or some successful type determined by the operation (in this case Vector[Friend]).

With that said, you can handle errors that may occur like invalid credentials, connection issues, etc...
  error   => println(error.msg),
  friends => friends.foreach(println)

See all operations for LoLChat HERE

Each Session also contains the following event streams:

  • Incoming message stream
sess.msgStream.foreach(msg => println(s"From summId:${msg.fromId} message:${msg.txt}"))
  • Friend list event stream
sess.friendListStream.foreach {
  case FriendAdded(summId)   =>
  case FriendRemoved(summId) =>
  case FriendRequest(summId) =>
  case FriendUpdated(friend) =>
  • Connection event Stream
sess.connectionEventStream.foreach {
  case ConnectionLost   =>
  case Reconnected      =>
  case ReconnectFailed  =>
  case ReconnectIn(sec) =>