Location-Based Services (LBS) have been widely deployed for the connected vehicle (CV) applications such as vehicle navigation,vehicle tracking and location-based augmented reality. The current LBS deployments have limitations in supporting time-critical CV use cases, including vehicle to vehicle (V2V), vehicle to infrastructure (V2I) and vehicle-to-people (V2P) safety applications. The paper presents the new LBS framework based on the publish-subscribe communication paradigm, to enable device-to-device (D2D) connections through use of selected application protocols in the application layer of the TCP/IP layered protocol model. Two publish-subscribe application protocols, Distributed Data Service (DDS) real-time publish and subscribe (DDS-RTPS) and Message Queue Telemetry Transport (MQTT), are introduced to support the LBS D2D applications. A number of test scenarios with Mosquitto MQTT and OpenDDS under 4G-mobile broadband (MBB) services are designed to assess the transmit/receive round-trip time (RTT) and packet-loss rate (PLR) with settings of a publisher to multiple subscribers, to simulate the connections to multiple vehicles. The transmission frequency is set for 10 Hz and the message sizes vary from 100 to 2000 Bytes. The PLRs are defined as the percentages of the delayed messages beyond a delay limit. Static test results with OpenDDS show that for the RTT delay beyond the limit of 100 ms, the total PLRs range between 5.25% and 8.76% for the message size of 50 to 2000 Bytes. Vehicle testing results with Mosquitto show that PLRs for the RTT delays between 200 ms and 1000 ms are 0.63%, 3.58% and 5.77%, for connections with 1, 4 and 10 vehicles, respectively. The results demonstrate the potential of the D2D LBS framework for medium-demanding CV safety applications such as V2P and V2I use cases, taking advantages of the 4G-MBB services and 5G extreme mobile broadband (eMBB) services and mobile devices generally available with all road users.