LLAPI custom spawn code for HLAPI network Identity communcation

Say I have follow code for communication(Server spawns the object, and tells client to spawn the object too):
///


/// tell client we have spawned a player.
///

///
private void AckClientSpawnPlayer(uint groupID, uint uniqueID, NetworkConnection conn)
{
GameObject entity = null;
// we generate a 3D Object when somebody logs in.
entityManager.GetPoolItem(characterID).InstantiateFromPool(spawnManager.Spawn(), Quaternion.identity, out entity);
// add connection on that network object(network base player connection)
Debug.Log("Add player for connection: " + conn + " entity null: " + (entity== null));
NetworkServer.AddPlayerForConnection(conn, entity, 0);
// send custom spawn message to our group.
S2CSpawnEntity msg = new S2CSpawnEntity();
msg.groupID = groupID;
msg.uniqueID = uniqueID;
msg.position = entity.transform.position;
msg.rotation = entity.transform.eulerAngles;
NetworkMessageExtension.SentToClientGroup(multiSessionModel.GetConnectionWithinGroup(groupID), msg, 1);

}

However, I spawn the exact same assetID object in Client, both have NetworkIdentity, would they just automatically connect and talk to eachother? Because using HLAPI’s NetworkServer.Spawn(obj) I am sure they are doing something internal things. But if I just instantiate a prefab in client with same networkIdentity, how can I make sure they can communicate with eachother in LLApi?

I debug.log all the server spawned netid for different network identities, but some of them are same, how were they still able to communicate to the right scripts between server and client.

Anybody, so basically how could I manage NetworkIdentity of HLAPI when I do the spawn manually?

I think the way unity does it is when the server spawns the object and wants to tell everyone else to spawn it, the server needs to send a ObjectSpawnMessage that basically passes the assetID of the prefab to spawn, as well as the netID of the objects NetworkIdentity. This way everyone else can spawn the object and set the NetworkIdentity netID to the same as the server, so now everyone is in sync.

Unitys HLAPI source code is open sourced here
https://bitbucket.org/Unity-Technologies/networking/src/78ca8544bbf4e87c310ce2a9a3fc33cdad2f9bb1?at=5.3

The related methods to object spawning that I have found are in
Messages ObjectSpawnMessage
NetworkServer SpawnObject, SendSpawnMessage
ClientScene OnObjectSpawn, ApplySpawnPayload

Yeah, I have checked out their code, it is internal related regarding to their observers and stuff, seems like writing the whole thing would be some what questioned, I was just wondering if any Unity Unet programmers have document on how to use LLAPI to spawn network identity type of documentation, or was this ever mentioned before.

HiddenMonk just told you how to do it. The code in the HLAPI is how you spawn an NetworkIdentity (which is part of the HLAPI…) using the LLAPI. Look at those three methods, duplicate what you need, etc.