This work present a collaborative indoor localization system which provides a lightweight location estimation solution for resource constrained IoT devices. The proposed EcoLoc, an encounterbased collaborative indoor localization system, uses the chance of encounter to enable the sharing and composition of multiple trajectories which are generated by Pedestrian Dead Reckoning. A collaborative version of Conditional Random Field is developed to merge these trajectories and generate the most probable location while signicantly shortening the convergence distance compared to the state-of-the-art techniques as particle filter. EcoLoc runs in realtime and can be distributed to resource-limited devices as opposed to running on centralized servers. Using the tablet and WICED Sense IoT platform, the convergence distance can be shorten by up to 40% on Android tablet and up to 50% on the WICED-Sense.